How we can create a rotating circle loader like a movie scene? Solution: See this Circle Rotate Loading Animation With Particles Background, Rotating and Pulse Effect.
Previously I have shared a loader pack with 12 different types of loading animation, but this is a unique one. Basically, a loader or preloader visualizes the loading process when a webpage loading. It is a way to entertain and attract your user while the page is loading, this is the reason why this also known as loading animation. Loaders come with different types of effects and animations some are rectangular, some are circular, and some with just text.
Today you will learn to create a loader with rotating and pulse effect. Basically, there is a circular rotating preloader animation with 3 circles. One circle is big, one is small, and one is smaller. And these circles have only stoke color not fully filled, two sides of circles are not available that create the design more creative. The circles rotating clockwise and anti-clockwise repeatedly, and it rotating opposite direction of each other. Middle of all circles there is a text “Loading” which has pulse effect. Also, there is particle animation in the background of the page.
So, Today I am sharing Circle Rotate Loading Animation With Particles. There I have used HTML and CSS for creating the program and animations, but the particles based on a JavaScript library. If you remove the particle effects, then this is a pure HTML CSS program. This is a cool loading effect, which you can use on your website.
If you are thinking now how this preloader actually is, then see the preview given below.
Preview Of Loader with Rotating and Pulse Effect
See this video preview to getting an idea of how this loader looks like.
Now you can see this animation visually, also you can see it live by pressing the button given above. If you like this, then get the source code of its.
You May Also Like:
- Responsive Flexbox Modals
- Stairway Hover Navigation
- 3D Progress Bar Animation
- Minimal SVG Analog Clock
Circle Rotate Loading Animation Source Code
Before sharing source code, let’s talk about it. First I have created a div with class name ‘preloader’ and placed another div inside it named ‘loader‘ and a span inside these two divs for text “Loading”. After that, I have created 2 more divs for the particle animations. In the HTML file, I have linked external files like CSS, JS, jQuery CDN, Particle.JS CDN.
Now using CSS I have placed all the elements in center, as you can see in the preview. There I have used CSS transform command to rotate the circles. I also used CSS @keyframe command to creating the animations effect like repeatedly rotating circle and pulse effect text. I also gave basic values like size, position, margin, padding, etc to the elements with CSS.
JavaScript file is here only for particle animation, if you don’t want the background effect then simply remove the JS file and related links in the HTML file. There I gave values like speed, density, area, etc which are pre-built command in the library. Left all other things you will understand after getting the codes, I can’t explain all in writing.
For creating this program you have to create 3 files. First file for HTML, second for CSS, and the third file for JavaScript. Follow the steps to creating this program without any error.
index.html
Create an HTML file named ‘index.html‘ and put these codes given below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<!DOCTYPE html> <!--Code By Webdevtrick ( https://webdevtrick.com )--> <html lang="en" > <head> <meta charset="UTF-8"> <title>Circle Rotate Loading Animation | Webdevtrick.com</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600|Roboto:700" rel="stylesheet"> <link rel="stylesheet" href="./style.css"> </head> <body> <div class="preloader"> <div class="loader"> <span class="text">Loading..</span> </div> </div> <div id="particleCanvas-Blue"></div> <div id="particleCanvas-White"></div> <script src='https://code.jquery.com/jquery-3.2.1.js'></script> <script src='https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js'></script> <script src="function.js"></script> </body> </html> |
style.css
Now create a CSS file named ‘style.css‘ and put these codes given here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
/* Code By Webdevtrick ( https://webdevtrick.com ) */ html { font-size: 62.5%; } body { margin: 0; padding: 0; font-family: "Open Sans", sans-serif; width: 100vw; height: 100vh; background: #222; } .preloader { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); width: 240px; height: 240px; border: 5px solid #00e676; border-radius: 120px; box-sizing: border-box; } .preloader:after { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); content: " "; display: block; background: #222; transform-origin: center; z-index: 0; } .preloader:after { width: 100px; height: 200%; -webkit-animation: outerRotate2 30s infinite linear; -moz-animation: outerRotate2 30s infinite linear; -o-animation: outerRotate2 30s infinite linear; animation: outerRotate2 30s infinite linear; } .preloader .loader { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); width: 200px; height: 200px; color: #888; text-align: center; border: 5px solid #08ff87; border-radius: 100px; box-sizing: border-box; z-index: 20; text-transform: uppercase; } .preloader .loader:after { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); content: " "; display: block; background: #222; transform-origin: center; z-index: -1; } .preloader .loader:after { width: 100px; height: 106%; -webkit-animation: outerRotate1 15s infinite linear; -moz-animation: outerRotate1 15s infinite linear; -o-animation: outerRotate1 15s infinite linear; animation: outerRotate1 15s infinite linear; } .preloader .loader .text { font-size: 14px; font-size: 1.4rem; line-height: 130px; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); -webkit-animation: textColour 1s alternate linear infinite; -moz-animation: textColour 1s alternate linear infinite; -o-animation: textColour 1s alternate linear infinite; animation: textColour 1s alternate linear infinite; display: block; width: 140px; height: 140px; text-align: center; border: 5px solid #05ff2d; border-radius: 70px; box-sizing: border-box; z-index: 20; } .preloader .loader .text:before, .preloader .loader .text:after { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); content: " "; display: block; background: #222; transform-origin: center; z-index: -1; } .preloader .loader .text:before { width: 110%; height: 40px; -webkit-animation: outerRotate2 3.5s infinite linear; -moz-animation: outerRotate2 3.5s infinite linear; -o-animation: outerRotate2 3.5s infinite linear; animation: outerRotate2 3.5s infinite linear; } .preloader .loader .text:after { width: 40px; height: 110%; -webkit-animation: outerRotate1 8s infinite linear; -moz-animation: outerRotate1 8s infinite linear; -o-animation: outerRotate1 8s infinite linear; animation: outerRotate1 8s infinite linear; } #particleCanvas-White { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); width: 100%; height: 50%; opacity: 0.1; } #particleCanvas-Blue { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-51%, -50%); -moz-transform: translate(-51%, -50%); -ms-transform: translate(-51%, -50%); -o-transform: translate(-51%, -50%); transform: translate(-51%, -50%); width: 300px; height: 300px; } @keyframes outerRotate1 { 0% { transform: translate(-50%, -50%) rotate(0); } 100% { transform: translate(-50%, -50%) rotate(360deg); } } @keyframes outerRotate2 { 0% { transform: translate(-50%, -50%) rotate(0); } 100% { transform: translate(-50%, -50%) rotate(-360deg); } } @keyframes textColour { 0% { color: #fff; } 100% { color: #05ff2d; } } |
function.js
The final step, create a JavaScript file named ‘function.js‘ and put the codes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
// Code By Webdevtrick ( https://webdevtrick.com ) particlesJS("particleCanvas-Blue", { particles: { number: { value: 100, density: { enable: true, value_area: 800 } }, color: { value: "#00e676" }, shape: { type: "circle", stroke: { width: 0, color: "#000000" }, polygon: { nb_sides: 3 }, image: { src: "img/github.svg", width: 100, height: 100 } }, opacity: { value: 0.5, random: false, anim: { enable: true, speed: 1, opacity_min: 0.1, sync: false } }, size: { value: 10, random: true, anim: { enable: false, speed: 10, size_min: 0.1, sync: false } }, line_linked: { enable: false, distance: 150, color: "#ffffff", opacity: 0.4, width: 1 }, move: { enable: true, speed: 0.5, direction: "none", random: true, straight: false, out_mode: "bounce", bounce: false, attract: { enable: false, rotateX: 394.57382081613633, rotateY: 157.82952832645452 } } }, interactivity: { detect_on: "canvas", events: { onhover: { enable: true, mode: "grab" }, onclick: { enable: false, mode: "push" }, resize: true }, modes: { grab: { distance: 200, line_linked: { opacity: 0.2 } }, bubble: { distance: 1500, size: 40, duration: 7.272727272727273, opacity: 0.3676323676323676, speed: 3 }, repulse: { distance: 50, duration: 0.4 }, push: { particles_nb: 4 }, remove: { particles_nb: 2 } } }, retina_detect: true }); particlesJS("particleCanvas-White", { particles: { number: { value: 250, density: { enable: true, value_area: 800 } }, color: { value: "#ffffff" }, shape: { type: "circle", stroke: { width: 0, color: "#000000" }, polygon: { nb_sides: 3 }, image: { src: "img/github.svg", width: 100, height: 100 } }, opacity: { value: 0.5, random: true, anim: { enable: false, speed: 0.2, opacity_min: 0, sync: false } }, size: { value: 15, random: true, anim: { enable: true, speed: 10, size_min: 0.1, sync: false } }, line_linked: { enable: false, distance: 150, color: "#ffffff", opacity: 0.4, width: 1 }, move: { enable: true, speed: 0.5, direction: "none", random: true, straight: false, out_mode: "bounce", bounce: false, attract: { enable: true, rotateX: 3945.7382081613637, rotateY: 157.82952832645452 } } }, interactivity: { detect_on: "canvas", events: { onhover: { enable: false, mode: "grab" }, onclick: { enable: false, mode: "push" }, resize: true }, modes: { grab: { distance: 200, line_linked: { opacity: 0.2 } }, bubble: { distance: 1500, size: 40, duration: 7.272727272727273, opacity: 0.3676323676323676, speed: 3 }, repulse: { distance: 50, duration: 0.4 }, push: { particles_nb: 4 }, remove: { particles_nb: 2 } } }, retina_detect: true }); |
That’s It. Now you have successfully created Circle Rotate Loading Animation With Particles, Preloader with Rotating and Pulse Effect. If you have any doubt or question comment down below.
Thanks For Visiting, Keep Visiting.
How do you put javascript into a Squarespace site?