How do I sync css animations? or even put it together? - html

My problem is that I want to loop the animation but I don't know how to solve it. i tried to use animation infinite unfortunately i couldn't solve the problem so i would contact you if you can help with this. The code would be the loading screen of a website. I want the animation to go on all the time. So how can this be solved?
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
#keyframes toXCenter {
to {
transform: translateX(-50%);
}
}
#keyframes toFullHeight {
to {
height: 100%;
}
}
body {
background-color: #ffffff;
font-family: 'Montserrat', sans-serif;
}
.icon {
animation: fadeIn 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 0.8s 1 forwards, fadeOut 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 7s 1 forwards;
background-color: rgba(0, 0, 0, 0.05);
border-radius: 50%;
height: 220px;
left: 50%;
opacity: 0;
overflow: hidden;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%);
width: 220px;
}
.icon__content {
animation: moveDown 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 6s 1 forwards;
height: 100%;
position: relative;
width: 100%;
}
#keyframes moveDown {
to {
transform: translateY(100%);
}
}
.icon__finger {
animation: toXCenter 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 1.2s 1 forwards;
background-color: #FFCC80;
border-radius: 50px 50px 0 0;
bottom: 0;
content: "";
height: 136px;
left: 50%;
overflow: hidden;
position: absolute;
right: 0;
transform: translateX(-50%) translateY(200px);
width: 95px;
z-index: 1;
}
.icon__finger:before {
background-color: rgba(0, 0, 0, 0.025);
content: "";
height: 100%;
position: absolute;
right: 0;
width: 50%;
z-index: -1;
}
.icon__finger:after {
background-color: rgba(0, 0, 0, 0.1);
border-radius: 0 0 50px 50px;
content: "";
height: 70px;
left: 15px;
position: absolute;
right: 15px;
top: 0;
}
.icon__nail {
animation: toXCenter 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 1.2s 1 forwards;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 20px 20px 50px 50px;
bottom: 75px;
content: "";
height: 110px;
left: 50%;
overflow: hidden;
position: absolute;
right: 0;
transform: translateX(-50%) translateY(200px);
width: 60px;
z-index: 2;
}
.icon__nail:before {
animation: toFullHeight 1.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2.2s 1 forwards;
background-color: #FFFFFF;
border-radius: 0 0 50px 50px;
bottom: 0;
content: "";
height: 0%;
position: absolute;
width: 100%;
z-index: 3;
}
.icon__nail:after {
animation: toFullHeight 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 3.6s 1 forwards, colours 4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 0s infinite alternate;
background-color: #F50057;
border-radius: 0 0 50px 50px;
bottom: 0;
content: "";
height: 0%;
position: absolute;
width: 100%;
z-index: 3;
}
#keyframes colours {
0% {
background-color: #E91E63;
}
50% {
background-color: #9C27B0;
}
100% {
background-color: #2196F3;
}
}
.nail__gloss {
border-radius: 0 0 20px;
bottom: 12px;
height: 100px;
overflow: hidden;
position: absolute;
right: 10px;
width: 26px;
z-index: 4;
}
.nail__gloss:before {
animation: toFullHeight 1.2s cubic-bezier(0.435, 0.715, 0.355, 0.595) 4.6s 1 forwards;
background-color: rgba(255, 255, 255, 0.5);
bottom: 0;
content: "";
height: 0%;
position: absolute;
right: 0;
width: 50%;
}
<div class="icon">
<div class="icon__content">
<div class="icon__nail">
<div class="nail__gloss"></div>
</div>
<div class="icon__finger">
</div>
</div>
</div>
https://codepen.io/drelaky/pen/LYybLMQ

I calculated the total animation time and it came to be about 8s. I have two answers for you:
Change the content of loader to restart the animation:
setInterval(() => {
let loader = document.querySelector("#loader");
let icon = loader.innerHTML;
loader.innerHTML = "";
loader.innerHTML = icon;
}, 8000);
#keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
#keyframes toXCenter {
to {
transform: translateX(-50%);
}
}
#keyframes toFullHeight {
to {
height: 100%;
}
}
body {
background-color: rgb(58, 58, 58);
}
.icon {
animation: fadeIn 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 0.8s 1 forwards, fadeOut 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 7s 1 forwards;
background-color: rgba(0, 0, 0, 0.05);
border-radius: 50%;
height: 220px;
left: 50%;
opacity: 0;
overflow: hidden;
position: absolute;
top: 50%;
transform: translateX(-50%) translateY(-50%);
width: 220px;
}
.icon__content {
animation: moveDown 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 6s 1 forwards;
height: 100%;
position: relative;
width: 100%;
}
#keyframes moveDown {
to {
transform: translateY(100%);
}
}
.icon__finger {
animation: toXCenter 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 1.2s 1 forwards;
background-color: #FFCC80;
border-radius: 50px 50px 0 0;
bottom: 0;
content: "";
height: 136px;
left: 50%;
overflow: hidden;
position: absolute;
right: 0;
transform: translateX(-50%) translateY(200px);
width: 95px;
z-index: 1;
}
.icon__finger:before {
background-color: rgba(0, 0, 0, 0.025);
content: "";
height: 100%;
position: absolute;
right: 0;
width: 50%;
z-index: -1;
}
.icon__finger:after {
background-color: rgba(0, 0, 0, 0.1);
border-radius: 0 0 50px 50px;
content: "";
height: 70px;
left: 15px;
position: absolute;
right: 15px;
top: 0;
}
.icon__nail {
animation: toXCenter 2s cubic-bezier(0.25, 0.54, 0.31, 0.995) 1.2s 1 forwards;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 20px 20px 50px 50px;
bottom: 75px;
content: "";
height: 110px;
left: 50%;
overflow: hidden;
position: absolute;
right: 0;
transform: translateX(-50%) translateY(200px);
width: 60px;
z-index: 2;
}
.icon__nail:before {
animation: toFullHeight 1.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2.2s 1 forwards;
background-color: #FFFFFF;
border-radius: 0 0 50px 50px;
bottom: 0;
content: "";
height: 0%;
position: absolute;
width: 100%;
z-index: 3;
}
.icon__nail:after {
animation: toFullHeight 1.4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 3.6s 1 forwards, colours 4s cubic-bezier(0.25, 0.54, 0.31, 0.995) 0s infinite alternate;
background-color: #F50057;
border-radius: 0 0 50px 50px;
bottom: 0;
content: "";
height: 0%;
position: absolute;
width: 100%;
z-index: 3;
}
#keyframes colours {
0% {
background-color: #E91E63;
}
50% {
background-color: #9C27B0;
}
100% {
background-color: #2196F3;
}
}
.nail__gloss {
border-radius: 0 0 20px;
bottom: 12px;
height: 100px;
overflow: hidden;
position: absolute;
right: 10px;
width: 26px;
z-index: 4;
}
.nail__gloss:before {
animation: toFullHeight 1.2s cubic-bezier(0.435, 0.715, 0.355, 0.595) 4.6s 1 forwards;
background-color: rgba(255, 255, 255, 0.5);
bottom: 0;
content: "";
height: 0%;
position: absolute;
right: 0;
width: 50%;
}
<div id='loader'>
<div class="icon">
<div class="icon__content">
<div class="icon__nail">
<div class="nail__gloss"></div>
</div>
<div class="icon__finger">
</div>
</div>
</div>
</div>
Record it using a screen recorder, convert it into gif and use it on the website. This will take less time and energy of the browser to render the loader.

Related

Animate borders to follow each other css

I want to make a border surrounding an HTML element to loop. You can find it in this pen that I managed to make it run once correctly. But, if I add infinite property to the animation it shows all after the first cycle. And this is not what I want in this case. How can I make the lines follow each other infinitely where only one line is visible?
html {
margin: 0;
padding: 0;
}
body {
position: relative;
font-family: sans-serif;
color: #fff;
background-color: #000;
}
.wrapper {
position: absolute;
top: 100%;
left: 50%;
transform: translate(-50%, 25%);
}
.heading-one {
margin: 0;
padding: 0;
border: 1px solid #fff;
padding: 30px;
font-size: 28px;
display: inline-block;
position: relative;
overflow: hidden;
}
.inner-border {
opacity: 0;
}
.inner-border:nth-child(1) {
content: '';
position: absolute;
top: -3px;
left: 0;
width: 80px;
height: 6px;
background-color: #fff;
animation: animate1 1s ease-in alternate;
}
#keyframes animate1 {
0% {
left: 0;
opacity: 1;
}
100% {
left: 100%;
opacity: 1;
}
}
.inner-border:nth-child(2) {
content: '';
position: absolute;
top: 0;
right: -3px;
height: 80px;
width: 6px;
background-color: #fff;
animation: animate2 1s ease-in 1s alternate;
}
#keyframes animate2 {
0% {
top: 0;
opacity: 1;
}
100% {
top: 100%;
opacity: 1;
}
}
.inner-border:nth-child(3) {
content: '';
position: absolute;
bottom: -3px;
right: 0;
height: 6px;
width: 80px;
background-color: #fff;
animation: animate3 1s ease-in 2s alternate;
}
#keyframes animate3 {
0% {
right: 0;
opacity: 1;
}
100% {
right: 100%;
opacity: 1;
}
}
.inner-border:nth-child(4) {
content: '';
position: absolute;
bottom: 0;
left: -3px;
width: 6px;
height: 80px;
background-color: #fff;
animation: animate4 1s ease-in 3s alternate;
}
#keyframes animate4 {
0% {
bottom: 0;
opacity: 1;
}
100% {
bottom: 100%;
opacity: 1;
}
}
<div class="wrapper">
<h1 class="heading-one">We Redefine Interior Designing
<span class="inner-border"></span>
<span class="inner-border"></span>
<span class="inner-border"></span>
<span class="inner-border"></span>
</h1>
</div>
Rather than using the timing offset, integrate the offset into the animation itself. In this way, the #keyframes declarations describe full loops and so can be animated continuously:
.inner-border:nth-child(1) {
content: '';
position: absolute;
top: -3px;
left: 0;
width: 80px;
height: 6px;
background-color: #fff;
animation: animate1 4s ease-in 0s infinite;
}
#keyframes animate1 {
0% {
left: -80px;
opacity: 1;
}
25% {
left: 100%;
opacity: 1;
}
100% {
left: 100%;
opacity: 0;
}
}
.inner-border:nth-child(2) {
content: '';
position: absolute;
top: 0;
right: -3px;
height: 80px;
width: 6px;
background-color: #fff;
animation: animate2 4s ease-in 0s infinite;
}
#keyframes animate2 {
0% {
top: -80px;
opacity: 0;
}
25% {
top: -80px;
opacity: 1;
}
50% {
top: 100%;
opacity: 1;
}
100% {
top: 100%;
opacity: 0;
}
}
.inner-border:nth-child(3) {
content: '';
position: absolute;
bottom: -3px;
right: 0;
height: 6px;
width: 80px;
background-color: #fff;
animation: animate3 4s ease-in infinite;
}
#keyframes animate3 {
0% {
right: -80px;
opacity: 0;
}
50% {
right: -80px;
opacity: 1;
}
75% {
right: 100%;
opacity: 1;
}
100% {
right: 100%;
opacity: 0;
}
}
.inner-border:nth-child(4) {
content: '';
position: absolute;
bottom: 0;
left: -3px;
width: 6px;
height: 80px;
background-color: #fff;
animation: animate4 4s ease-in infinite;
}
#keyframes animate4 {
0% {
bottom: -80px;
opacity: 0;
}
75% {
bottom: -80px;
opacity: 1;
}
100% {
bottom: 100%;
opacity: 1;
}
}

The CSS animated loader work correctly only once in IE 11

The CSS loader doesn't work sometimes in IE 11. When the page is loaded for the first time, everything is OK. But after the first correct one, the loader is displayed incorrectly, and only the central stick changes it's size. Seems like :before and :after pieces don't work properly. How can I fix it for IE 11? It works fine for Chrome, for example.
.loader {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: -1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: 1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
opacity: 0.7;
z-index: 3;
}
Working Demo:
.loader {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: -1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
width: 0.8em;
height: 4em;
background: #1C5685;
content: '';
position: absolute;
top: 0;
left: 1.5em;
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: white;
opacity: 0.7;
z-index: 3;
}
<div id="loadingDiv">
<div class="loader">Loading...</div>
</div>
UPD:
It was to pulse like this
But it did it like this (only middle stick pulsed)
So the solution was found by myself - to replace the unproperly working in IE ":before" and ":after" pseudo-elements with REAL elements, to update their animation delays and to put them together (they are not displayed by default and become visible on loadings):
<!-- 3 loadingDiv's with loaders inside: 1 div for each of 3 animated sticks of loader -->
<div style="display:none" id="loadingDiv1">
<div class="loader1" >Loading...</div>
</div>
<div style="display:none" id="loadingDiv2">
<div class="loader2" >Loading...</div>
</div>
<div style="display:none" id="loadingDiv3">
<div class="loader3" >Loading...</div>
</div>
.loader1,
.loader2,
.loader3 {
background: #1C5685;
position: relative;
width: 0.8em;
height: 4em;
margin: 250px auto;
color: #1C5685;
text-indent: -9999em;
font-size: 11px;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load1 1s infinite ease-in-out;
animation: load1 1s infinite ease-in-out;
}
.loader1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
/* .loader3 has 0 delay */
#-webkit-keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#keyframes load1 {
0%,
80%,
100% {
box-shadow: 0 0;
height: 4em;
}
40% {
box-shadow: 0 -2em;
height: 5em;
}
}
#loadingDiv1,
#loadingDiv2,
#loadingDiv3 {
position: fixed;
top: 0;
width: 100%;
height: 100%;
opacity: 0.7;
z-index: 3;
}
#loadingDiv1 {
left: -1em;
background-color: white;
}
#loadingDiv2 {
left: 0;
}
#loadingDiv3 {
left: 1em;
}

How To Shrink My Loading Screen (CSS, HTML)

So, I found this loading screen on the internet and I made a bunch of tweaks to it but I am not sure how to shrink it. Here is my code:
CSS
body {
background-color: #90EE90;
}
#loading-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#loading-text {
display: block;
position: absolute;
top: 100%;
left: 100%;
color: #999;
width: 100px;
height: 30px;
margin: -7px 0 0 -45px;
text-align: center;
font-family: 'PT Sans Narrow', sans-serif;
font-size: 20px;
}
#loading-content {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 170px;
height: 170px;
margin: -85px 0 0 -85px;
border: 3px solid #F00;
}
#loading-content:after {
content: "";
position: absolute;
border: 3px solid #0F0;
left: 15px;
right: 15px;
top: 15px;
bottom: 15px;
}
#loading-content:before {
content: "";
position: absolute;
border: 3px solid #00F;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
#loading-content {
border: 3px solid transparent;
border-top-color: #20B2AA;
border-bottom-color: #20B2AA;
border-radius: 50%;
-webkit-animation: loader 3.5s linear infinite;
-moz-animation: loader 3.5s linear infinite;
-o-animation: loader 3.5s linear infinite;
animation: loader 3.5s linear infinite;
}
#loading-content:before {
border: 3px solid transparent;
border-top-color: #778899;
border-bottom-color: #778899;
border-radius: 50%;
-webkit-animation: loader 2.5s linear infinite;
-moz-animation: loader 2.5s linear infinite;
-o-animation: loader 2.5s linear infinite;
animation: loader 3s linear infinite;
}
#loading-content:after {
border: 3px solid transparent;
border-top-color: #84417C;
border-bottom-color: #84417C;
border-radius: 50%;
-webkit-animation: loader 1s linear infinite;
animation: loader 1s linear infinite;
-moz-animation: loader 1.5s linear infinite;
-o-animation: loader 1.5s linear infinite;
}
#-webkit-keyframes loaders {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes loader {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
Transform: rotate (0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#content-wrapper {
color: #FFF;
position: fixed;
left: 0;
top: 20px;
width: 100%;
height: 100%;
}
#header
{
width: 800px;
margin: 0 auto;
text-align: center;
height: 100px;
background-color: #666;
}
#content
{
width: 800px;
height: 1000px;
margin: 0 auto;
text-align: center;
background-color: #888;
}
HTML
<div id="loading-wrapper">
<div id="loading-text">LOADING</div>
<div id="loading-content"></div>
</div>
So, I am trying to get my loading screen to be smaller so it doesn't take up so much of the page please. Thanks in advance!
Change the width, height, and margin inside #loading-content proportionally:
#loading-content {
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
}
Demo Snippet:
body {
background-color: #90EE90;
}
#loading-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#loading-text {
display: block;
position: absolute;
top: 100%;
left: 100%;
color: #999;
width: 100px;
height: 30px;
margin: -7px 0 0 -45px;
text-align: center;
font-family: 'PT Sans Narrow', sans-serif;
font-size: 20px;
}
#loading-content {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
border: 3px solid #F00;
}
#loading-content:after {
content: "";
position: absolute;
border: 3px solid #0F0;
left: 15px;
right: 15px;
top: 15px;
bottom: 15px;
}
#loading-content:before {
content: "";
position: absolute;
border: 3px solid #00F;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
#loading-content {
border: 3px solid transparent;
border-top-color: #20B2AA;
border-bottom-color: #20B2AA;
border-radius: 50%;
-webkit-animation: loader 3.5s linear infinite;
-moz-animation: loader 3.5s linear infinite;
-o-animation: loader 3.5s linear infinite;
animation: loader 3.5s linear infinite;
}
#loading-content:before {
border: 3px solid transparent;
border-top-color: #778899;
border-bottom-color: #778899;
border-radius: 50%;
-webkit-animation: loader 2.5s linear infinite;
-moz-animation: loader 2.5s linear infinite;
-o-animation: loader 2.5s linear infinite;
animation: loader 3s linear infinite;
}
#loading-content:after {
border: 3px solid transparent;
border-top-color: #84417C;
border-bottom-color: #84417C;
border-radius: 50%;
-webkit-animation: loader 1s linear infinite;
animation: loader 1s linear infinite;
-moz-animation: loader 1.5s linear infinite;
-o-animation: loader 1.5s linear infinite;
}
#-webkit-keyframes loaders {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#keyframes loader {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
Transform: rotate (0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#content-wrapper {
color: #FFF;
position: fixed;
left: 0;
top: 20px;
width: 100%;
height: 100%;
}
#header
{
width: 800px;
margin: 0 auto;
text-align: center;
height: 100px;
background-color: #666;
}
#content
{
width: 800px;
height: 1000px;
margin: 0 auto;
text-align: center;
background-color: #888;
}
<div id="loading-wrapper">
<div id="loading-text">LOADING</div>
<div id="loading-content"></div>
</div>

Increase Ripple Effect Waves

I have created a ripple effect in this circle. Everything looks great, but I want that this effect happen more often. It takes to long time for the other wave to appear when the other is gone. I tried to increase the animation speed, but it doesn't look good:
Here is what I've done so far:
.pulse {
width: 300px;
height: 300px;
background: #bdebca;
border: 1px solid #b9e8c9;
border-radius: 50%;
z-index: -1;
text-align: center;
position: absolute;
transform: scale(0.1, 0.1);
animation: ring-1 2s ease-out infinite
}
#keyframes ring-1 {
0% {
transform: scale(0.1, 0.1);
opacity: 0
}
50% {
opacity: 1
}
100% {
transform: scale(1.2, 1.2);
opacity: 0
}
}
.ripple-icon .inner {
background-color: lightblue;
color: #fff;
/* animation: pulse 2s infinite; */
}
.icon .inner {
width: 200px;
height: 200px;
text-align: center;
line-height: 200px;
display: inline-block;
border-radius: 100%;
font-size: 22px;
color: #fff;
text-align: center;
font-weight: 700;
position: relative;
top: 50%;
transform: translateY(-50%);
box-shadow: 0px 0px 103.74px 10.26px rgba(250, 250, 250, 0.5);
cursor: pointer;
}
.icon {
width: 300px;
height: 300px;
border-radius: 100%;
text-align: center;
position: absolute;
top: 50%;
text-align: center;
transform: translateY(-50%);
margin: 0 auto;
left: 50%;
margin-left: -150px;
}
<div class="ripple-icon icon hvr-bounce-in">
<div class="inner">
Ripple
</div>
<div class="pulse" style="left: 0px; top: 0px;"></div>
</div>
Something like this? Add more ripple's and delay the start of animation by 0.5s, 1s, 1.5s and 2s respectively.
Read more about animation delay:
https://developer.mozilla.org/en/docs/Web/CSS/animation-delay
https://css-tricks.com/almanac/properties/a/animation/
.pulse1,
.pulse2,
.pulse3,
.pulse4 {
width: 300px;
height: 300px;
background: #bdebca;
border: 1px solid #b9e8c9;
border-radius: 50%;
z-index: -1;
text-align: center;
position: absolute;
transform: scale(0.1, 0.1);
}
.pulse1 {
animation: ring-1 2s 0.5s ease-out infinite;
}
.pulse2 {
animation: ring-1 2s 1s ease-out infinite;
}
.pulse3 {
animation: ring-1 2s 1.5s ease-out infinite;
}
.pulse4 {
animation: ring-1 2s 2s ease-out infinite;
}
#keyframes ring-1 {
0% {
transform: scale(0.1, 0.1);
opacity: 0
}
50% {
opacity: 1
}
100% {
transform: scale(1.2, 1.2);
opacity: 0
}
}
.ripple-icon .inner {
background-color: lightblue;
color: #fff;
/* animation: pulse 2s infinite; */
}
.icon .inner {
width: 200px;
height: 200px;
text-align: center;
line-height: 200px;
display: inline-block;
border-radius: 100%;
font-size: 22px;
color: #fff;
text-align: center;
font-weight: 700;
position: relative;
top: 50%;
transform: translateY(-50%);
box-shadow: 0px 0px 103.74px 10.26px rgba(250, 250, 250, 0.5);
cursor: pointer;
}
.icon {
width: 300px;
height: 300px;
border-radius: 100%;
text-align: center;
position: absolute;
top: 50%;
text-align: center;
transform: translateY(-50%);
margin: 0 auto;
left: 50%;
margin-left: -150px;
}
<div class="ripple-icon icon hvr-bounce-in">
<div class="inner">
Ripple
</div>
<div class="pulse1" style="left: 0px; top: 0px;"></div>
<div class="pulse2" style="left: 0px; top: 0px;"></div>
<div class="pulse3" style="left: 0px; top: 0px;"></div>
<div class="pulse4" style="left: 0px; top: 0px;"></div>
</div>
In the .pulse css you can change the animation: ring-1 0.5s ease-out infinite
I have changed the speed from 2s to 0.5s

Understanding how a candle flame is created in a simple SVG

I was just looking at a simple SVG cake animation HERE , the CSS code looks like so:
#import url(http://fonts.googleapis.com/css?family=Lato:300italic);
html,
body {
width: 100%;
height: 100%;
}
body {
background: #ee9ca7;
}
#cake {
display: block;
position: relative;
margin: -10em auto 0 auto;
}
*/* ============================================== Candle
*/
.velas {
background: #ffffff;
border-radius: 10px;
position: absolute;
top: 228px;
left: 50%;
margin-left: -2.4px;
margin-top: -8.33333333px;
width: 5px;
height: 35px;
transform: translateY(-300px);
backface-visibility: hidden;
animation: in 500ms 6s ease-out forwards;
}
.velas:after,
.velas:before {
background: rgba(255, 0, 0, 0.4);
content: "";
position: absolute;
width: 100%;
height: 2.22222222px;
}
.velas:after {
top: 25%;
left: 0;
}
.velas:before {
top: 45%;
left: 0;
}
/* ============================================== Fire
*/
.fuego {
border-radius: 100%;
position: absolute;
top: -20px;
left: 50%;
margin-left: -2.6px;
width: 6.66666667px;
height: 18px;
}
.fuego:nth-child(1) {
animation: fuego 2s 6.5s infinite;
}
.fuego:nth-child(2) {
animation: fuego 1.5s 6.5s infinite;
}
.fuego:nth-child(3) {
animation: fuego 1s 6.5s infinite;
}
.fuego:nth-child(4) {
animation: fuego 0.5s 6.5s infinite;
}
.fuego:nth-child(5) {
animation: fuego 0.2s 6.5s infinite;
}
/* ============================================== Animation Fire
*/
#keyframes fuego {
0%, 100% {
background: rgba(254, 248, 97, 0.5);
box-shadow: 0 0 40px 10px rgba(248, 233, 209, 0.2);
transform: translateY(0) scale(1);
}
50% {
background: rgba(255, 50, 0, 0.1);
box-shadow: 0 0 40px 20px rgba(248, 233, 209, 0.2);
transform: translateY(-20px) scale(0);
}
}
#keyframes in {
to {
transform: translateY(0);
}
}
.text {
color: #8b6a60;
font-family: 'Lato', sans-serif;
font-weight: 300;
font-style:italic;
text-align: center;
h1 {
font-size: 1.4em;
}
}
After inspecting the code a bit i came to know the candle flame was caused by this set of HTML elements:
<div class="velas">
<div class="fuego"></div>
<div class="fuego"></div>
<div class="fuego"></div>
<div class="fuego"></div>
<div class="fuego"></div>
</div>
And this HTML has the following CSS code:
background: #ffffff;
border-radius: 10px;
position: absolute;
top: 228px;
left: 50%;
margin-left: -2.4px;
margin-top: -8.33333333px;
width: 5px;
height: 35px;
transform: translateY(-300px);
backface-visibility: hidden;
animation: in 500ms 6s ease-out forwards;
}
.velas:after,
.velas:before {
background: rgba(255, 0, 0, 0.4);
content: "";
position: absolute;
width: 100%;
height: 2.22222222px;
}
.velas:after {
top: 25%;
left: 0;
}
.velas:before {
top: 45%;
left: 0;
}
/* ============================================== Fire
*/
.fuego {
border-radius: 100%;
position: absolute;
top: -20px;
left: 50%;
margin-left: -2.6px;
width: 6.66666667px;
height: 18px;
}
.fuego:nth-child(1) {
animation: fuego 2s 6.5s infinite;
}
.fuego:nth-child(2) {
animation: fuego 1.5s 6.5s infinite;
}
.fuego:nth-child(3) {
animation: fuego 1s 6.5s infinite;
}
.fuego:nth-child(4) {
animation: fuego 0.5s 6.5s infinite;
}
.fuego:nth-child(5) {
animation: fuego 0.2s 6.5s infinite;
}
/* ============================================== Animation Fire
*/
#keyframes fuego {
0%, 100% {
background: rgba(254, 248, 97, 0.5);
box-shadow: 0 0 40px 10px rgba(248, 233, 209, 0.2);
transform: translateY(0) scale(1);
}
50% {
background: rgba(255, 50, 0, 0.1);
box-shadow: 0 0 40px 20px rgba(248, 233, 209, 0.2);
transform: translateY(-20px) scale(0);
}
}
#keyframes in {
to {
transform: translateY(0);
}
}
Now i don't see the CSS code that is actually cauing the red and yellow flame , i beleive the white shadow is caused by the very high box shadow given in the animations , but somehow i don't see where the candle flame is created , can somebody guide me as to where the candle flame is really created ?
The colors are set by RGB values. There's a yellow, red, and some pink.
#keyframes fuego {
0%, 100% {
background: rgba(254, 248, 97, 0.5); /* yellow */
box-shadow: 0 0 40px 10px rgba(248, 233, 209, 0.2); /* pink */
transform: translateY(0) scale(1);
}
50% {
background: rgba(255, 50, 0, 0.1); /* red */
box-shadow: 0 0 40px 20px rgba(248, 233, 209, 0.2); /* pink again */
transform: translateY(-20px) scale(0);
}
}
Timings to change the colors are set in .fuego:nth-child(1) through .fuego:nth-child(6)