CSS3 Breathing Particles
How do I make an css3 breathing particles?
These particles seem to breath in a virtual 3d space. I just had some fun with css3 transition and animation.. What is a css3 breathing particles? How do you make a css3 breathing particles? This script and codes were developed by Gianluca Guarini on 04 November 2022, Friday.
CSS3 Breathing Particles - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS3 Breathing Particles</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <ul> </ul> <script src="js/index.js"></script>
</body>
</html>
CSS3 Breathing Particles - Script Codes CSS Codes
html { overflow:hidden; background:-webkit-gradient(radial, 50% 50%, 0, 50% 50%, 960, from(#C0FCFB), to(#999)) no-repeat #999; background: -moz-radial-gradient(50% 50% 0deg,ellipse farthest-corner, #C0FCFB, #999, #999 170%); background: -o-radial-gradient(50% 50%, #C0FCFB, #999); height:100%; } ul li { list-style:none; position:absolute; -moz-transition: all 1s cubic-bezier(0.600, -0.280, 0.735, 0.045); -webkit-transition: all 1s cubic-bezier(0.600, -0.280, 0.735, 0.045); -o-transition: all 1s cubic-bezier(0.600, -0.280, 0.735, 0.045); transition: all 1s cubic-bezier(0.600, -0.280, 0.735, 0.045); border-radius:300px; border:7px solid rgba(240,232,235, 0.1); background:rgba(255,255,255,0.50); }
@-webkit-keyframes pulse { 0% { -webkit-transform: scale(1); }
50% { -webkit-transform: scale(1.1); } 100% { -webkit-transform: scale(1); }
}
@-moz-keyframes pulse { 0% { -moz-transform: scale(1); }
50% { -moz-transform: scale(1.1); } 100% { -moz-transform: scale(1); }
}
@-o-keyframes pulse { 0% { -o-transform: scale(1); }
50% { -o-transform: scale(1.1); } 100% { -o-transform: scale(1); }
}
@keyframes pulse { 0% { transform: scale(1); }
50% { transform: scale(1.1); } 100% { transform: scale(1); }
}
CSS3 Breathing Particles - Script Codes JS Codes
// Global Vars var ul = document.querySelector("ul"), list = document.createDocumentFragment(), w = window, particles = 60, domPrefixes = 'Webkit Moz O ms Khtml'.split(' '), animationstring = 'animation', pfx = '';
var getAnimationString = function () { for( var i = 0; i < domPrefixes.length; i++ ) { if( ul.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) { pfx = domPrefixes[ i ]; return animationstring = pfx + 'Animation'; } }
}; // this function changes the inline style of the argument passed var setElementStyle = function (elm) { // setting the syle of the element randomly (note the use of the double tilde to round the numbers) var size = ~~(Math.random() * 150), position = { x: ~~(Math.random() * w.innerWidth) - (size / 2), y: ~~(Math.random() * w.innerHeight) - (size / 2), }; elm.style.width = elm.style.height = size + "px"; elm.style.top = position.y + "px"; elm.style.left = position.x + "px"; elm.style[getAnimationString()] = "pulse "+ ~~(Math.random() * 3) * 3 + "s infinite"; elm.style[pfx+"Transition"] = "all "+ ~~(Math.random() * 3) + 3 +"s cubic-bezier(0.600, -0.280, 0.735, 0.045) "+ ~~(Math.random() *3) + "s"; return elm; }; // changing the inline style of all the li in this page var moveElements = function () { var liArray = document.querySelectorAll("li"), i = liArray.length; while (i --) { setElementStyle(liArray[i]); } }; // this function initializes the example appending the particles to the DOM var init = function (){ while (particles --) { var newLi = document.createElement("li"); list.appendChild(setElementStyle(newLi)); } ul.appendChild(list); }; // let's rock this party init(); // Event Handlers w.addEventListener("resize",moveElements); w.addEventListener("click",moveElements); w.addEventListener("touchstart",moveElements);
Developer | Gianluca Guarini |
Username | GianlucaGuarini |
Uploaded | November 04, 2022 |
Rating | 3 |
Size | 2,756 Kb |
Views | 24,288 |
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 |
Riot and es6 | 2,779 Kb |
Appletv | 6,368 Kb |
CSS3 Breathing Particles | 2,756 Kb |
3D Box-shadow | 1,732 Kb |
The Dark Loop | 4,130 Kb |
Find your mouse cursor | 3,687 Kb |
Css3D Wall | 2,441 Kb |
EasyAnimationFrame.js | 2,382 Kb |
Tocca.js | 4,270 Kb |
The Milk Glass | 26,300 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 |
CSS Link Icons with jQuery Titles | Nicwinn | 2,312 Kb |
IE11 Test | Boostnewmedia | 4,998 Kb |
Flying Bee | Pwsm50 | 3,711 Kb |
Isometric css island | Xaddict | 2,950 Kb |
SnappySnippet Test | Elmsoftware | 8,385 Kb |
LeMandinque | Aadesida | 9,046 Kb |
HEXAGON | Aurumlux | 1,684 Kb |
Click Based Rotation Demo | Zeaklous | 2,086 Kb |
A Pen by Adrien Clerbois | AClerbois | 6,501 Kb |
Portfolio Page | HuffmanJ25 | 5,240 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!