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 |
Site under construction | 9,039 Kb |
Threejs-amd-bootstrap | 1,555 Kb |
Css3D Wall | 2,441 Kb |
Colored Wall | 2,551 Kb |
Find your mouse cursor | 3,687 Kb |
Tocca.js | 4,270 Kb |
Riot and es6 | 2,779 Kb |
EasyAnimationFrame.js | 2,382 Kb |
The Dark Loop | 4,130 Kb |
Riot simple movies live search | 3,501 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 |
Guidepopup | Wooljs | 3,747 Kb |
CSS3 Snow Animation | NickyCDK | 1,695 Kb |
Sidebar Thing | Jonambas | 2,779 Kb |
Basic 3D Fullscreen Transition | Apetrov | 3,270 Kb |
Perforated foil | 0x04 | 2,617 Kb |
Velocity.js custom stagger | Tommiehansen | 4,805 Kb |
Scoreboard.js basic usage | Tbleckert | 1,733 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
Flat UI Button | Honchoman | 2,289 Kb |
Google Fonts Sass Mixin | HugoGiraudel | 4,237 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!