Editting the CSS animation - css

I found a css animation online, but i wanted to edit it a bit.
This is the link to the animation
Is there anyway i can make this animation run only when a certain button on the website is clicked, and is it possible that the door opens only once and it leads to a different site on the other end of the door??
Right now the door animation is running infinite times. Please help
body {
display: flex;
width: 100%;
height: 100vh;
background: #222;
perspective: 100vw;
overflow: hidden;
animation: squiggly-anim 0.4s infinite;
-webkit-animation: squiggly-anim 0.2s infinite;
}
#-webkit-keyframes squiggly-anim {
0% {
filter: url("#squiggly-0");
}
25% {
filter: url("#squiggly-1");
}
50% {
filter: url("#squiggly-2");
}
75% {
filter: url("#squiggly-3");
}
100% {
filter: url("#squiggly-4");
}
}
#keyframes squiggly-anim {
0% {
filter: url("#squiggly-0");
}
25% {
filter: url("#squiggly-1");
}
50% {
filter: url("#squiggly-2");
}
75% {
filter: url("#squiggly-3");
}
100% {
filter: url("#squiggly-4");
}
}
body .door {
position: absolute;
width: 100px;
height: 200px;
left: calc(50% - 50px);
top: calc(50% - 100px);
box-shadow: inset 0 -5px 0 0 #222, inset 0 0 0 1px #fff, 0 5px 0 0 #222, 0 0 0 100vw #222;
perspective: 500px;
transform-style: preserve-3d;
-webkit-animation: scaling 5s linear infinite;
animation: scaling 5s linear infinite;
transform: translateZ(-1px);
}
body .door:nth-of-type(3) {
-webkit-animation-delay: 1.25s;
animation-delay: 1.25s;
}
body .door:nth-of-type(3) .face {
-webkit-animation-delay: 1.25s;
animation-delay: 1.25s;
}
body .door:nth-of-type(2) {
-webkit-animation-delay: 2.5s;
animation-delay: 2.5s;
}
body .door:nth-of-type(2) .face {
-webkit-animation-delay: 2.5s;
animation-delay: 2.5s;
}
body .door:nth-of-type(1) {
-webkit-animation-delay: 3.75s;
animation-delay: 3.75s;
}
body .door:nth-of-type(1) .face {
-webkit-animation-delay: 3.75s;
animation-delay: 3.75s;
}
#-webkit-keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
z-index: 0;
}
50% {
transform: translateZ(100vw);
opacity: 1;
z-index: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
z-index: 2;
}
100% {
transform: translateZ(300vw);
opacity: 0;
z-index: 3;
}
}
body .door:after {
content: "";
position: absolute;
width: 200vw;
height: 100vw;
left: -50vw;
bottom: 5px;
box-shadow: 0 1px 0 0 #fff;
z-index: -1;
}
body .door .face {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: calc(100% - 4px);
transform-style: preserve-3d;
box-shadow: inset 0 0 0 1px #fff;
background: #222;
transform-origin: left;
-webkit-animation: swing 5s ease-in-out infinite;
animation: swing 5s ease-in-out infinite;
}
body .door .face:before {
content: "";
position: absolute;
width: 10px;
height: 10px;
box-shadow: 0 0 0 1px #fff;
border-radius: 100%;
right: 10px;
top: calc(50% - 5px);
transform-style: preserve-3d;
transform: translateZ(6px);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background: #222;
}
body .door .face:after {
content: "";
position: absolute;
width: 4px;
height: 2.5px;
box-shadow: 0 0 0 1px #fff;
opacity: 0.75;
border-radius: 0;
right: 10px;
top: calc(50% - 1.25px);
transform-style: preserve-3d;
transform: translateZ(2.5px) rotateY(90deg);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background: #222;
}
#-webkit-keyframes swing {
15% {
transform: rotateY(0deg);
}
50% {
transform: rotateY(-125deg) translateZ(-2px);
}
75% {
transform: rotateY(-125deg);
}
100% {
transform: rotateY(-125deg);
}
}
#keyframes swing {
15% {
transform: rotateY(0deg);
}
50% {
transform: rotateY(-125deg) translateZ(-2px);
}
75% {
transform: rotateY(-125deg);
}
100% {
transform: rotateY(-125deg);
}
}
body .door .face .right {
position: absolute;
width: 10%;
background: #222;
height: 100%;
top: 0;
right: -10%;
transform-origin: left;
transform: rotateY(90deg);
box-shadow: inset 0 0 0 1px #fff;
}
<div class='door'>
<div class='face'>
<div class='right'></div>
</div>
</div>
<div class='door'>
<div class='face'>
<div class='right'></div>
</div>
</div>
<div class='door'>
<div class='face'>
<div class='right'></div>
</div>
</div>
<div class='door'>
<div class='face'>
<div class='right'></div>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="display:none">
<defs>
<filter id="squiggly-0">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="0"/>
<feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="2" />
</filter>
<filter id="squiggly-1">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="1"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="3" />
</filter>
<filter id="squiggly-2">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="2"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="2" />
</filter>
<filter id="squiggly-3">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="3"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="3" />
</filter>
<filter id="squiggly-4">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="4"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="1" />
</filter>
</defs>
</svg>

There are a three main parts to this question.
First, how to have just one door in the animation. There are 4 divs with class door. If we take 3 of these out the remaining one animates, but there is a delay before the animation (needed in the original so that the 4 doors started their movements at staggered times) so we take that out. While we are at it we notice that there are several #keyframes repeated - only the last one would be used so we remove those too.
Second, the requirement is to start the door animation on clicking a button. So we add a button element and in JS attach an event listener to it. When clicked it will add the class 'open' to the door. In the CSS the animation to the door and the door face are changed so they are added when the class is open.u
Third the requirement is to go to a website when the door has opened. Ideally one would want the website gradually revealed as the door is opened. This can be achieved if the website is under our control, for example the code could be run at the start of the website and it would gradually get revealed. If not a similar effect can be achieved by putting the target website in an iframe and gradually revealing it. However, many websites do not allow this and in this snippet just for fun we have put an image behind the door and gone to the website only once it is fully open. This is just to demonstrate possibilities. There may be a better way of doing it - let's hope so.
let page = "https://stackoverflow.com";
let button = document.getElementById('opendoor');
let door = document.querySelector('.door');
let face = document.querySelector('.face');
//document.querySelector("#target").src = page;//only do this if the target website lets you have an iframe
button.addEventListener('click', function () {
door.classList.add('open');
button.style.display = 'none';
document.body.style.animation = 'none';
});
face.addEventListener('webkitAnimationEnd', gotopage);//webkit still needed for some browsers
face.addEventListener('animationEnd', gotopage);
function gotopage() {
document.getElementById('doorwrapper').style.display = 'none';
window.location= page;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: #222;
width: 100%;
height: 100vh;
overflow: hidden;
perspective: 100vw;
overflow: hidden;
animation: squiggly-anim 0.4s infinite;
}
#doorwrapper {
position: absolute;
top: -10px;
left: -10px;/* attempt to stop shakiness at margin black against white */
display: flex;
width: calc(100vw + 20px);
height: calc(100vh + 20px);
background-color: transparent;
z-index: 99999;
}
#keyframes squiggly-anim {
0% {
filter: url("#squiggly-0");
}
25% {
filter: url("#squiggly-1");
}
50% {
filter: url("#squiggly-2");
}
75% {
filter: url("#squiggly-3");
}
100% {
filter: url("#squiggly-4");
}
}
#doorwrapper .door {
position: absolute;
width: 100px;
height: 200px;
left: calc(50% - 50px);
top: calc(50% - 100px);
box-shadow: inset 0 -5px 0 0 #222, inset 0 0 0 1px #fff, 0 5px 0 0 #222, 0 0 0 100vw #222;
perspective: 500px;
transform-style: preserve-3d;
animation-fill-mode: forwards;
transform: translateZ(-1px);
}
#doorwrapper .door.open {
animation: scaling 5s linear 1;
}
#keyframes scaling {
0% {
transform: translateZ(0vw);
opacity: 1;
}
50% {
transform: translateZ(100vw);
opacity: 1;
}
95% {
transform: translateZ(200vw);
opacity: 1;
}
100% {
transform: translateZ(300vw);
opacity: 0;
}
}
#doorwrapper .door:after {
content: "";
position: absolute;
width: 200vw;
height: 100vw;
left: -50vw;
bottom: 5px;
box-shadow: 0 1px 0 0 #fff;
z-index: -1;
}
#doorwrapper .door .face {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: calc(100% - 4px);
transform-style: preserve-3d;
box-shadow: inset 0 0 0 1px #fff;
background: #222;
transform-origin: left;
animation-fill-mode: forwards;
}
#doorwrapper .door.open .face {
animation: swing 5s ease-in-out 1;
}
#doorwrapper .door .face:before {
content: "";
position: absolute;
width: 10px;
height: 10px;
box-shadow: 0 0 0 1px #fff;
border-radius: 100%;
right: 10px;
top: calc(50% - 5px);
transform-style: preserve-3d;
transform: translateZ(6px);
backface-visibility: hidden;
background: #222;
}
#doorwrapper .door .face:after {
content: "";
position: absolute;
width: 4px;
height: 2.5px;
box-shadow: 0 0 0 1px #fff;
opacity: 0.75;
border-radius: 0;
right: 10px;
top: calc(50% - 1.25px);
transform-style: preserve-3d;
transform: translateZ(2.5px) rotateY(90deg);
backface-visibility: hidden;
background: #222;
}
#keyframes swing {
15% {
transform: rotateY(0deg);
}
50% {
transform: rotateY(-125deg) translateZ(-2px);
}
75% {
transform: rotateY(-125deg);
}
100% {
transform: rotateY(-125deg);
}
}
#doorwrapper .door .face .right {
position: absolute;
width: 10%;
background: #222;
height: 100%;
top: 0;
right: -10%;
transform-origin: left;
transform: rotateY(90deg);
box-shadow: inset 0 0 0 1px #fff;
}
<div id="doorwrapper">
<div class='door'>
<div class='face'>
<div class='right'></div>
</div>
</div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="display:none">
<defs>
<filter id="squiggly-0">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="0"/>
<feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="2" />
</filter>
<filter id="squiggly-1">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="1"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="3" />
</filter>
<filter id="squiggly-2">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="2"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="2" />
</filter>
<filter id="squiggly-3">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="3"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="3" />
</filter>
<filter id="squiggly-4">
<feTurbulence id="turbulence" baseFrequency="0.01" numOctaves="3" result="noise" seed="4"/>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="1" />
</filter>
</defs>
</svg>
<button id="opendoor" style="position: absolute; top: 10px; left: 10px; color: white; background-color: red; z-index: 99999;">Open the door</button>
<!-- YOUR WEBSITE - OR IFRAME WITH THE TARGET WEBSITE IN IT (OR WILL GO TO WEBSITE ON END OF ANIMATION IF IFRAME NOT ALLOWED -->
<!-- <iframe id="target" width=100% height=100% src=""></iframe> -->
<img id="mywebsite" src="https://i.stack.imgur.com/qsQbR.jpg" style="position: relative; top: 0; left: 0; z-index: 0; width: 100vw; height: auto;"/>

Related

Bootstrap button & loading animation

I've added loading animation to the bootstrap button, and it is not showing correctly.
I've added a div to the button with the class "loader". But the loading animation is showing under the button.
How can I fix it with responsive design
Here is codepen: https://codepen.io/ayxano/pen/oNNxgQx
.loader,
.loader:before,
.loader:after {
border-radius: 50%;
width: 2.5em;
height: 2.5em;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation: load7 1.8s infinite ease-in-out;
animation: load7 1.8s infinite ease-in-out;
}
.loader {
color: #ffffff;
font-size: 10px;
position: relative;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.loader:before,
.loader:after {
content: '';
position: absolute;
top: 0;
}
.loader:before {
left: -3.5em;
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loader:after {
left: 3.5em;
}
#-webkit-keyframes load7 {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
#keyframes load7 {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
The issue is with the box-shadow. You are using a y-offset of 2.5em.
Try below CSS in this particular case:
.center-block.loader {
top: -2.5em;
}

CSS circle-progress-bar

I would like to use the progress-bar here at https://bootsnipp.com/snippets/featured/circle-progress-bar, but I don't know how to set less than 50% when you have 2, 3 or more types (each got different percentage) of these on your website, because this code sets right-side of bar for every type u got there and I don't know what to do when I want less than 50% only at 3.
Type of bar:
.progress .progress-right .progress-bar{
left: -100%;
border-top-left-radius: 80px;
border-bottom-left-radius: 80px;
border-right: 0;
-webkit-transform-origin: center right;
transform-origin: center right;
animation: loading-1 1.8s linear forwards;
}
+
#keyframes loading-1{
0%{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100%{
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
Could someone help me please ?
Using SVG
svg {
transform: rotate(-90deg);
stroke-dasharray: 251; /* (2PI * 40px) */
stroke-dashoffset: 251;
animation: offsettozero 5s linear forwards;
}
#keyframes offsettozero {
to {
stroke-dashoffset: 0;
}
}
<svg height="100" width="100">
<circle cx="50" cy="50" r="40" stroke="#428bca" stroke-width="6" fill="#333" />
</svg>
<!-- VV Click "Run code snippet" for demo -->
Since the right-side animation is shared among all the progress circles, if you want to make one that is less than 50%, you'll have to override that generic style. Then you won't need a left-side animation.
So your CSS would be something like:
.progress.yourDiv .progress-right .progress-bar {
animation: yourAnimation 1.8s linear forwards;
}
.progress.yourDiv .progress-left .progress-bar{
animation: none;
}
Where yourAnimation is the same as the shared right-side rule for .progress .progress-right .progress-bar in the Bootstrap example, except the name is changed.
For an animation to 37.5%, yourAnimation would look like this:
#keyframes yourAnimation{
0%{
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100%{
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
}
}
Here's an example, where .yourDiv is .yellow and yourAnimation is loading-3.
.progress {
width: 150px;
height: 150px !important;
float: left;
line-height: 150px;
background: none;
margin: 20px;
box-shadow: none;
position: relative;
}
.progress:after {
content: "";
width: 100%;
height: 100%;
border-radius: 50%;
border: 12px solid #fff;
position: absolute;
top: 0;
left: 0;
}
.progress>span {
width: 50%;
height: 100%;
overflow: hidden;
position: absolute;
top: 0;
z-index: 1;
}
.progress .progress-left {
left: 0;
}
.progress .progress-bar {
width: 100%;
height: 100%;
background: none;
border-width: 12px;
border-style: solid;
position: absolute;
top: 0;
}
.progress .progress-left .progress-bar {
left: 100%;
border-top-right-radius: 80px;
border-bottom-right-radius: 80px;
border-left: 0;
-webkit-transform-origin: center left;
transform-origin: center left;
}
.progress .progress-right {
right: 0;
}
.progress .progress-right .progress-bar {
left: -100%;
border-top-left-radius: 80px;
border-bottom-left-radius: 80px;
border-right: 0;
-webkit-transform-origin: center right;
transform-origin: center right;
animation: loading-1 1.8s linear forwards;
}
.progress .progress-value {
width: 90%;
height: 90%;
border-radius: 50%;
background: #44484b;
font-size: 24px;
color: #fff;
line-height: 135px;
text-align: center;
position: absolute;
top: 5%;
left: 5%;
}
.progress.blue .progress-bar {
border-color: #049dff;
}
.progress.blue .progress-left .progress-bar {
animation: loading-2 1.5s linear forwards 1.8s;
}
.progress.yellow .progress-bar {
border-color: #fdba04;
}
.progress.yellow .progress-right .progress-bar {
animation: loading-3 1.8s linear forwards;
}
.progress.yellow .progress-left .progress-bar {
animation: none;
}
#keyframes loading-1 {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
}
}
#keyframes loading-2 {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(144deg);
transform: rotate(144deg);
}
}
#keyframes loading-3 {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
}
}
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<div class="progress blue">
<span class="progress-left">
<span class="progress-bar"></span>
</span>
<span class="progress-right">
<span class="progress-bar"></span>
</span>
<div class="progress-value">90%</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="progress yellow">
<span class="progress-left">
<span class="progress-bar"></span>
</span>
<span class="progress-right">
<span class="progress-bar"></span>
</span>
<div class="progress-value">37.5%</div>
</div>
</div>

Css Animation - animation delay

Update - The pen below has been updated to show the end results.
I am trying to mimic signal animation using css animation but I cant seem to grasp the idea of animation delay. If you look here
http://codepen.io/anon/pen/YwZOmK?editors=110
.real-time-animation {
margin-top: 20px;
position: relative;
transform: scale(0.5) rotate(45deg);
transform-origin: 5% 0%;
}
.real-time-animation>div {
animation: sk-bouncedelay 3s infinite forwards;
}
.circle1 {
animation-delay: 2s;
}
.circle2 {
animation-delay: 1s;
}
#keyframes sk-bouncedelay {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.circle {
position: relative;
width: 16em;
height: 16em;
border-radius: 50%;
background: transparent;
border: 20px solid transparent;
border-top-color: darkblue;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.circle2 {
top: 40px;
width: 12em;
height: 12em;
left: 33px;
}
.circle3 {
top: 80px;
width: 8em;
height: 8em;
left: 66px;
}
<div class="real-time-animation">
<div class="circle circle1"> </div>
<div class="circle circle2"> </div>
<div class="circle circle3"> </div>
</div>
You should be able to understand what I am trying to accomplish. I want to start from showing nothing, then after 1 sec show the first bar, then after 1 sec, show the 2nd bar and finally after another 1 sec show the 3rd bar.
My solution:
http://codepen.io/anon/pen/JGWmJg?editors=110
.real-time-animation{
margin-top: 20px;
position: relative;
transform: scale(0.5) rotate(45deg);
transform-origin: 5% 0%;
}
.circle1, .circle2, .circle3{
animation: 4s infinite ease-in;
animation-delay: 1s;
}
.circle1{
animation-name: circle1;
}
.circle2{
animation-name: circle2;
}
.circle3{
animation-name: circle3;
}
#keyframes circle1 {
0%{
opacity: 0;
}
25%{
opacity: 0;
}
50%{
opacity: 0;
}
75%{
opacity: 1;
}
100% {
opacity: 0;
}
}
#keyframes circle2 {
0%{
opacity: 0;
}
25%{
opacity: 0;
}
50%{
opacity: 1;
}
75% {
opacity: 1;
}
100%{
opacity: 0;
}
}
#keyframes circle3 {
0%{
opacity: 0;
}
25%{
opacity: 1;
}
50%{
opacity: 1;
}
75% {
opacity: 1;
}
100%{
opacity: 0;
}
}
.circle {
position: relative;
width: 16em; height: 16em;
border-radius: 50%;
background: transparent;
border: 20px solid transparent;
border-top-color: darkblue;
position: absolute;
top: 0;
left: 0;
opacity: 0;
}
.circle2{
top: 40px;
width: 12em;
height: 12em;
left: 33px;
}
.circle3{
top: 80px;
width: 8em;
height: 8em;
left: 66px;
}
You can change the speed of the animation duration: "animation: 4s infinite ease-in;"
As I understand your question animated opacity needs to be like this:
Progress \ Element
.circle1
.circle2
.circle3
0%
0
0
0
25%
0
0
1
50%
0
1
1
75%
1
1
1
100%
0
0
0
The opacity property is clamped which means if you set negative values, it will have the same effect as setting it to 0. The same goes for values larger than 1.
Using this property, we can subtract a constant value from predefined CSS variables and use that as opacity.
.real-time-animation {
zoom: 10;
width: 8px;
height: 8px;
position: relative;
display: inline-block;
}
.real-time-animation>.circle {
animation: circle 4s infinite ease-in;
}
.circle1 {
--circle: 1;
}
.circle2 {
--circle: 2;
}
.circle3 {
--circle: 3;
}
#keyframes circle {
0%, 100% {
opacity: 0;
}
25% {
opacity: calc(var(--circle) - 2);
}
50% {
opacity: calc(var(--circle) - 1);
}
75% {
opacity: 1;
}
}
.circle {
border-radius: 50%;
background: transparent;
border: 1px solid transparent;
border-top-color: darkblue;
position: absolute;
margin: 0;
box-sizing: border-box;
top: 100%;
left: 0%;
width: calc(16px - (var(--circle) - 1)*4px);
height: calc(16px - (var(--circle) - 1)*4px);;
transform: rotate(45deg) translate(-50%, -50%);
transform-origin: 0 0;
}
<div class="real-time-animation">
<div class="circle circle1"> </div>
<div class="circle circle2"> </div>
<div class="circle circle3"> </div>
</div>

How do I prevent Safari css keyframe animation flicker?

I've tried everything from adding extra keyframes (0%, 1%, 100% or 0%, 99%, 100%) to setting -webkit-animation-fill-mode to forwards to the oft-mentioned -webkit-backface-visibility: hidden; trick mentioned in other threads, but I'm still seeing a flicker in my css keyframe animation at the start of almost every animation iteration in Safari 7 (both desktop and iOS). Chrome seems to be flicker-free.
JSBin: http://jsbin.com/julor/2/edit
HTML:
<div class="ripple"></div>
CSS:
body {
background-color: #90CBEA;
}
.ripple, .ripple:before, .ripple:after {
background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, .15) 100%);
border-radius: 50%;
position: absolute;
top: 50%; left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
}
.ripple:before, .ripple:after {
content: '';
display: block;
}
.ripple {
-webkit-animation-name: innerRipple;
-webkit-animation-duration: 3s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-out;
&:before {
-webkit-animation-name: ripple;
-webkit-animation-duration: 3s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-out;
}
&:after {
-webkit-animation-name: outerRipple;
-webkit-animation-duration: 3s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-out;
}
}
#-webkit-keyframes innerRipple {
from {
height: 0px;
width: 0px;
opacity: 1;
}
to {
height: 200px;
width: 200px;
opacity: 0;
}
}
#-webkit-keyframes ripple {
from {
height: 0px;
width: 0px;
opacity: 1;
}
to {
height: 300px;
width: 300px;
opacity: 0;
}
}
#-webkit-keyframes outerRipple {
from {
height: 0px;
width: 0px;
opacity: 1;
}
to {
height: 340px;
width: 340px;
opacity: 0;
}
}
Adding a frame in between a little earlier than at 99% made the flickering disappear on Safari! (Safari 8 OS X)
#-webkit-keyframes innerRipple {
0% { height: 0px; width: 0px; opacity: 1; }
95% { height: 200px; width: 200px; opacity: 0; }
100% { width: 0px; height: 0px; opacity: 0; }
}
#-webkit-keyframes ripple {
0% { height: 0px; width: 0px; opacity: 1; }
95% { height: 300px; width: 300px; opacity: 0; }
100% { width: 0px; height: 0px; opacity: 0; }
}
#-webkit-keyframes outerRipple {
0% { height: 0px; width: 0px; opacity: 1; }
95% { height: 340px; width: 340px; opacity: 0; }
100% { width: 0px; height: 0px; opacity: 0; }
}

Marker animation working in Chrome browser and not in Safari

How do I make the below animation fully work in safari browser ? It is working fine in Chrome.
Open the below link in chrome to see its full functionality (bounce and pulse effect), and in Safari to see the issue. Pulse effect around the pin doesn't work in safari!!
How can I fix this ?
Here is the JS FIDDLE link
html code:
<div class='pin bounce'></div>
<div class='pulse'></div>
CSS code:
body {
background: #e6e6e6;
}
.pin {
width: 30px;
height: 30px;
border-radius: 50% 50% 50% 0;
background: #00cae9;
position: absolute;
-webkit-transform: rotate(-45deg);
left: 50%;
top: 50%;
margin: -20px 0 0 -20px;
}
.pin:after {
content: "";
width: 14px;
height: 14px;
margin: 8px 0 0 8px;
background: #e6e6e6;
position: absolute;
border-radius: 50%;
}
.bounce {
-webkit-animation-name: bounce;
-webkit-animation-fill-mode: both;
-webkit-animation-duration: 1s;
}
.pulse {
background: #d6d4d4;
border-radius: 50%;
height: 14px;
width: 14px;
position: absolute;
left: 50%;
top: 50%;
margin: 11px 0px 0px -12px;
-webkit-transform: rotateX(55deg);
z-index: -2;
}
.pulse:after {
content: "";
border-radius: 50%;
height: 40px;
width: 40px;
position: absolute;
margin: -13px 0 0 -13px;
-webkit-animation: pulsate 1s ease-out;
-webkit-animation-iteration-count: infinite;
opacity: 0;
box-shadow: 0 0 1px 2px #00cae9;
-webkit-animation-delay: 1.1s;
}
#-webkit-keyframes pulsate {
0% {
-webkit-transform: scale(0.1, 0.1);
opacity: 0;
}
50% {
opacity: 1;
}
100% {
-webkit-transform: scale(1.2, 1.2);
opacity: 0;
}
}
#-webkit-keyframes bounce {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px) rotate(-45deg);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px) rotate(-45deg);
}
80% {
-webkit-transform: translateY(-10px) rotate(-45deg);
}
100% {
-webkit-transform: translateY(0) rotate(-45deg);
}
}

Resources