Web animations material ripple
How do I make an web animations material ripple?
What is a web animations material ripple? How do you make a web animations material ripple? This script and codes were developed by KyleDavidE on 11 August 2022, Thursday.
Web animations material ripple - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>web animations material ripple</title> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ .ripple{ position:absolute; width:100vmax; height:100vmax; top:-50vmax; left:-50vmax; border-radius:50%;
}
body{ overflow:hidden;
}
.pad{ position:absolute; left:0; right:0; top:0; bottom:0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <!-- touch or click -->
<div class="pad"></div> <script src="js/index.js"></script>
</body>
</html>
Web animations material ripple - Script Codes CSS Codes
.ripple{ position:absolute; width:100vmax; height:100vmax; top:-50vmax; left:-50vmax; border-radius:50%;
}
body{ overflow:hidden;
}
.pad{ position:absolute; left:0; right:0; top:0; bottom:0;
}
Web animations material ripple - Script Codes JS Codes
var slowMo = false;
var dur = slowMo ? 5000 : 500;
function $(id){ return document.getElementById(id);
}
var players = {};
var hue = 0;
function addTouch(e){ var el = document.createElement('div'); el.classList.add('ripple'); var color = 'hsl('+(hue+=70)+',100%,50%)'; el.style.background = color; var trans = 'translate('+e.pageX+'px,'+e.pageY+'px) ' console.log(trans); var player = el.animate([ {opacity: 0.5, transform: trans+"scale(0) "}, {opacity: 1.0, transform: trans+"scale(2) "} ], { duration: dur }); player.playbackRate = 0.1; players[e.identifier || 'mouse'] = player; document.body.appendChild(el); player.onfinish = function(){ if(!document.querySelector('.ripple ~ .pad')) each(document.getElementsByClassName('pad'),function(e){ e.remove(); }); el.classList.remove('ripple'); el.classList.add('pad'); }
}
function dropTouch(e){ players[e.identifier || 'mouse'].playbackRate = 1;
}
function each(l,fn){ for(var i = 0; i < l.length; i++){ fn(l[i]); }
}
document.body.onmousedown = addTouch;
document.body.onmouseup = dropTouch;
document.body.ontouchstart = function(e){ e.preventDefault(); each(e.changedTouches,addTouch);
};
document.body.ontouchend = function(e){ e.preventDefault(); each(e.changedTouches,dropTouch);
};
var el = document.body;
function prevent(e){ e.preventDefault();
}
el.addEventListener("touchstart", prevent, false); el.addEventListener("touchend", prevent, false); el.addEventListener("touchcancel", prevent, false); el.addEventListener("touchleave", prevent, false); el.addEventListener("touchmove", prevent, false);
function fakeTouch(){ var touch = { pageX:Math.random()*innerWidth, pageY:Math.random()*innerHeight, identifier:'fake_'+Math.random()+'__fake' } addTouch(touch); var length = Math.random()*1000+500; setTimeout(function(){ dropTouch(touch); },length) setTimeout(function(){ fakeTouch(); },length - 100)
}
if(location.pathname.match(/fullcpgrid/i)) fakeTouch(); //demo in grid
Developer | KyleDavidE |
Username | KyleDavidE |
Uploaded | August 11, 2022 |
Rating | 3.5 |
Size | 2,672 Kb |
Views | 28,336 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Abstract shape 3d | 6,805 Kb |
Flexbox Dna Helix by Joe Ski | 4,041 Kb |
A Pen by KyleDavidE | 4,166 Kb |
A lonely pixel rag | 3,976 Kb |
XKCD 1608 Hoverboard zoomable | 7,038 Kb |
A Pen by KyleDavidE | 4,557 Kb |
Sunshades | 4,337 Kb |
BLOCK CLOCK | 4,215 Kb |
Android 4.4 kitkat time picker | 6,524 Kb |
A lonely rectangle | 2,729 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
The Fly | GianlucaGuarini | 3,405 Kb |
Multi-step GSAP animation | Acacheung | 2,668 Kb |
Day 1 - Portfolio | Chpecson | 3,532 Kb |
A Pen by Matt Popovich | Mpopv | 3,349 Kb |
Blog Concept - Single Post | Marionebl | 9,603 Kb |
ECharts Version 3.0 - Bar Marker Chart | WebCodePro | 2,726 Kb |
STIKHOI | Denmch | 7,122 Kb |
Find The Penguin | Lelder | 2,212 Kb |
SnappySnippet Test | Elmsoftware | 8,385 Kb |
TheCalendar.js | The-teacher | 6,330 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!