CSS3 3D Particles
How do I make an css3 3d particles?
New particle divs are constantly created via JS. The animation happens via CSS: transitioning the particles to random transform values.. What is a css3 3d particles? How do you make a css3 3d particles? This script and codes were developed by Timo Hausmann on 16 October 2022, Sunday.
CSS3 3D Particles - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS3 3D Particles</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <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! */ html,
body,
#scene { width: 100%; height: 100%;
}
body { background: black;
}
#scene { perspective: 150px; /* the lower this is, the fancier it gets */
}
#emitter { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; animation: rotate 4s infinite linear;
}
.particle { position: absolute; width: 10px; height: 10px; background: white; border-radius: 20%; transition: 1s ease-in;
}
@keyframes rotate { 0% { transform: rotateY(0) rotateZ(-180deg); } 100% { transform: rotateY(360deg) rotateZ(180deg); }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div id="scene"> <div id="emitter"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
CSS3 3D Particles - Script Codes CSS Codes
html,
body,
#scene { width: 100%; height: 100%;
}
body { background: black;
}
#scene { perspective: 150px; /* the lower this is, the fancier it gets */
}
#emitter { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; animation: rotate 4s infinite linear;
}
.particle { position: absolute; width: 10px; height: 10px; background: white; border-radius: 20%; transition: 1s ease-in;
}
@keyframes rotate { 0% { transform: rotateY(0) rotateZ(-180deg); } 100% { transform: rotateY(360deg) rotateZ(180deg); }
}
CSS3 3D Particles - Script Codes JS Codes
var $emitter = $('#emitter'), emitEvery = 50, //emit new particle every X ms removeAfter = 1000; //remove particles after X ms
function create() { //create particle and random values var $particle = $('<div class="particle" />'), x = Math.randMinMax(-200, 200), y = Math.randMinMax(-200, 50), z = Math.randMinMax(-200, 200), degree = Math.randMinMax(0, 360), color = 'hsla(' + Math.randMinMax(200, 320) + ', 80%, 60%, 1)'; //append particle to dom $particle.css('background', color); $emitter.append( $particle ); //after a short timeout, set css to be transitioned to. Without the timeout, we would not see the transition window.setTimeout(function() { $particle.css({ webkitTransform: 'translateX(' + x + 'px) translateY(' + y + 'px) translateZ(' + z + 'px) rotateX(' + degree + 'deg)', opacity: 0 }); }, 50); //remove current particle after time window.setTimeout(function() { $particle.remove(); }, removeAfter); //create next particle window.setTimeout(create, emitEvery);
}
//https://gist.github.com/timohausmann/4997906
Math.randMinMax=function(t,n,a){var r=t+Math.random()*(n-t)
return a&&(r=Math.round(r)),r}
//execute first particle creation
create();
![CSS3 3D Particles - Script Codes](http://shots.codepen.io/timohausmann/pen/zxBnd-512.jpg)
Developer | Timo Hausmann |
Username | timohausmann |
Uploaded | October 16, 2022 |
Rating | 4.5 |
Size | 2,859 Kb |
Views | 32,384 |
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 |
Tunnel Quest | 4,379 Kb |
Simple CSS 3D Cubes | 2,894 Kb |
Vector Based Movement | 2,568 Kb |
Tekken Particles | 3,560 Kb |
Spring Physics | 3,272 Kb |
Valentines Day | 3,118 Kb |
Particle Button | 3,807 Kb |
Depth First Search Maze | 2,693 Kb |
Use your mousewheel | 4,109 Kb |
Color Wheel. Literally. | 6,392 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 |
Angular Route | Arun_v606 | 1,837 Kb |
Html5-canvas-snow-effect | MariamMassadeh | 2,609 Kb |
Wave Lines | Mikehobizal | 4,023 Kb |
Slim Grid SASS SCSS v3.2 | Thesturs | 4,709 Kb |
ECharts Version 3.0 - Bar Marker Chart | WebCodePro | 2,726 Kb |
Flat UI - Checkbox FIX | ARS | 2,663 Kb |
Objects | Bonzaipenguin | 2,616 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
CSS Chat Bubbles | Boylett | 2,094 Kb |
Scroll to top button | DominicFrancois | 3,743 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!