CSS animation working differently in Chrome - html

I am using CSS animation. The IE and Firefox browsers are working fine but in Chrome the wheels keep spinning even after the car is gone.
body {
font-family: Helvetica, Arial, sans-serif;
margin: 0px;
}
#headline1, #headline2{
background-image: url(http://i.share.pho.to/6846bb0a_o.png);
background-repeat: no-repeat;
width: 261px;
height: 25px;
position: absolute;
top: 20px;
left: 20px;
}
#headline1{
-webkit-animation: fade-in .1s ease 6s 1 reverse forwards;
-moz-animation: fade-in .1s ease 6s 1 reverse forwards;
-o-animation: fade-in .1s ease 6s 1 reverse forwards;
animation: fade-in .1s ease 6s 1 reverse forwards;
}
#headline2 {
background-position: 0px -25px;
top: 40px;
-webkit-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
-moz-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
-o-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
}
button {
background: #FFCB05;
height: 34px;
width: 130px;
border: none;
z-index: 999;
border-radius: 17px;
color: #000;
cursor: pointer;
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
outline: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
user-select: none;
-webkit-animation: fade-in 1s ease 7s 1 both;
-moz-animation: fade-in 1s ease 7s 1 both;
-o-animation: fade-in 1s ease 7s 1 both;
animation: fade-in 1s ease 7s 1 both;
}
button:hover,
button:active {
background-color: #FFD716;
}
.sub-copy {
color: #FFF;
position: absolute;
margin-left: 25px;
top: 40px;
-webkit-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-moz-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-o-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
}
#dis {
background-image: url(http://i.share.pho.to/4516683d_o.jpeg);
background-repeat: no-repeat;
width: 138px;
height: 19px;
position: absolute;
margin-left: 22px;
top: 206px;
-webkit-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-moz-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-o-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
}
#logo {
background-image: url(http://i.share.pho.to/306d2b9c_o.png);
background-repeat: no-repeat;
width: 103px;
height: 26px;
position: absolute;
bottom: 20px;
right: 20px;
}
#tag-line {
background-image: url(http://i.share.pho.to/e62322ba_o.jpeg);
background-repeat: no-repeat;
width: 207px;
height: 40px;
position: absolute;
bottom: 153px;
left: 14px;
-webkit-animation: fade-in 1s ease 10.5s 1 both;
-moz-animation: fade-in 1s ease 10.5s 1 both;
-o-animation: fade-in 1s ease 10.5s 1 both;
animation: fade-in 1s ease 10.5s 1 both;
}
#girl-arm {
position: absolute;
top: 141px;
left: 133px;
width: 9px;
height: 5px;
z-index: 7;
opacity: 0;
background-image: url(http://i.share.pho.to/5a840ac3_o.gif);
background-repeat: no-repeat;
background-position: -37px -34px;
-webkit-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
-moz-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
-o-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
}
#girl-1 {
position: absolute;
top: 107px;
left: 96px;
width: 84px;
height: 85px;
background-image: url(http://i.share.pho.to/5a840ac3_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#clock-lamp {
position: absolute;
top: 104px;
left: 184px;
width: 24px;
height: 88px;
background-image: url(http://i.share.pho.to/d264b4e6_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#clock2 {
position: absolute;
top: 74px;
left: 181px;
width: 29px;
height: 117px;
background-image: url(http://i.share.pho.to/24b90b3c_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-moz-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-o-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-ms-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
}
#desk-car {
position: absolute;
top: 102px;
left: 33px;
width: 204px;
height: 90px;
z-index: 5;
background-image: url(http://i.share.pho.to/0c2e3ceb_o.png);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
-moz-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
-o-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
}
#window-l, #window-r{
position: absolute;
top: 79px;
width: 59px;
height: 69px;
background-image: url(http://i.share.pho.to/4bf00ac7_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#window-l{
left: 18px;
}
#window-r{
left: 218px;
}
#wheel-l, #wheel-r{
position: absolute;
top: 157px;
width: 32px;
height: 33px;
opacity: 0;
z-index: 9;
background-image: url(http://i.share.pho.to/08185b2c_o.png);
background-repeat: no-repeat;
-webkit-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-moz-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-o-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
}
#wheel-l{
left: 57px;
}
#wheel-r{
left: 184px;
}
#ad {
display: block;
border: rgb(145, 153, 153) 1px solid;
overflow: hidden;
cursor: pointer;
width: 298px;
height: 248px;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
#banner {
position: absolute;
display: block;
width: 300px;
height: 250px;
background-color: #000;
background-position: 0px 0px;
background-repeat: no-repeat;
overflow: hidden;
}
.buttons {
position: absolute;
z-index: 20;
top: 110px;
left: 20px;
}
/* ANIMATIONS */
/* WEBKIT */
#-webkit-keyframes frame-animation {
0% {background-position: 0 0; }
100% {background-position: 0 -4920px; }
}
#-webkit-keyframes frame-girl-1 {
0% {background-position: 0 0; }
100% {background-position: -364px 0; }
}
#-webkit-keyframes frame-girl-2 {
0% {background-position: 0 0; opacity: 1; }
100% {background-position: -364px 0; opacity: 1; }
}
#-webkit-keyframes frame-clock-lamp {
0% {background-position: 0 0;}
100% {background-position: -660px 0;}
}
#-webkit-keyframes move-left {
from {-webkit-transform: translateX(0);}
to {-webkit-transform: translateX(-250px);}
}
#-webkit-keyframes frame-desk-car {
0% {background-position: 0 0;}
100% {background-position: 0 -2418px;}
}
#-webkit-keyframes frame-window {
0% {background-position: 0 0;}
100% {background-position: -354px 0;}
}
#-webkit-keyframes roll-wheel {
0%{-webkit-transform: rotate(0deg); opacity: 1;}
100% {-webkit-transform: rotate(360deg); opacity: 1;}
}
#-webkit-keyframes fade-in {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-webkit-keyframes mask-in {
0% {background-position: 0 -50px; opacity: 0;}
100% {background-position: 0 -25px; opacity: 1;}
}
#-webkit-keyframes rotate-arm {
0%{-webkit-transform: rotate(0deg); -webkit-transform-origin: 0% 0%; opacity: 1;}
100% {-webkit-transform: rotate(-10deg); -webkit-transform-origin: 0% 0%; opacity: 1;}
}
/* MOZ */
#-moz-keyframes frame-animation {
0% {background-position: 0 0; }
100% {background-position: 0 -4920px; }
}
#-moz-keyframes frame-girl-1 {
0% {background-position: 0 0; }
100% {background-position: -364px 0; }
}
#-moz-keyframes frame-girl-2 {
0% {background-position: 0 0; opacity: 1; }
100% {background-position: -364px 0; opacity: 1; }
}
#-moz-keyframes frame-clock-lamp {
0% {background-position: 0 0;}
100% {background-position: -660px 0;}
}
#-moz-keyframes move-left {
from {-moz-transform: translateX(0);}
to {-moz-transform: translateX(-250px);}
}
#-moz-keyframes frame-desk-car {
0% {background-position: 0 0;}
100% {background-position: 0 -2418px;}
}
#-moz-keyframes frame-window {
0% {background-position: 0 0;}
100% {background-position: -354px 0;}
}
#-moz-keyframes roll-wheel {
0%{-moz-transform: rotate(0deg); opacity: 1;}
100% {-moz-transform: rotate(360deg); opacity: 1;}
}
#-moz-keyframes fade-in {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-moz-keyframes mask-in {
0% {background-position: 0 -50px; opacity: 0;}
100% {background-position: 0 -25px; opacity: 1;}
}
#-moz-keyframes rotate-arm {
0%{-moz-transform: rotate(0deg); -moz-transform-origin: 0% 0%; opacity: 1;}
100% {-moz-transform: rotate(-10deg); -moz-transform-origin: 0% 0%; opacity: 1;}
}
/* ms */
#-ms-keyframes frame-animation {
0% {background-position: 0 0; }
100% {background-position: 0 -4920px; }
}
#-ms-keyframes frame-girl-1 {
0% {background-position: 0 0; }
100% {background-position: -364px 0; }
}
#-ms-keyframes frame-girl-2 {
0% {background-position: 0 0; opacity: 1; }
100% {background-position: -364px 0; opacity: 1; }
}
#-ms-keyframes frame-clock-lamp {
0% {background-position: 0 0;}
100% {background-position: -660px 0;}
}
#-ms-keyframes move-left {
from {-ms-transform: translateX(0);}
to {-ms-transform: translateX(-250px);}
}
#-ms-keyframes frame-desk-car {
0% {background-position: 0 0;}
100% {background-position: 0 -2418px;}
}
#-ms-keyframes frame-window {
0% {background-position: 0 0;}
100% {background-position: -354px 0;}
}
#-ms-keyframes roll-wheel {
0%{-ms-transform: rotate(0deg); opacity: 1;}
100% {-ms-transform: rotate(360deg); opacity: 1;}
}
#-ms-keyframes fade-in {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-ms-keyframes mask-in {
0% {background-position: 0 -50px; opacity: 0;}
100% {background-position: 0 -25px; opacity: 1;}
}
#-ms-keyframes rotate-arm {
0%{-ms-transform: rotate(0deg); -ms-transform-origin: 0% 0%; opacity: 1;}
100% {-ms-transform: rotate(-10deg); -ms-transform-origin: 0% 0%; opacity: 1;}
}
/* O */
#-o-keyframes frame-animation {
0% {background-position: 0 0; }
100% {background-position: 0 -4920px; }
}
#-o-keyframes frame-girl-1 {
0% {background-position: 0 0; }
100% {background-position: -364px 0; }
}
#-o-keyframes frame-girl-2 {
0% {background-position: 0 0; opacity: 1; }
100% {background-position: -364px 0; opacity: 1; }
}
#-o-keyframes frame-clock-lamp {
0% {background-position: 0 0;}
100% {background-position: -660px 0;}
}
#-o-keyframes move-left {
from {-o-transform: translateX(0);}
to {-o-transform: translateX(-250px);}
}
#-o-keyframes frame-desk-car {
0% {background-position: 0 0;}
100% {background-position: 0 -2418px;}
}
#-o-keyframes frame-window {
0% {background-position: 0 0;}
100% {background-position: -354px 0;}
}
#-o-keyframes roll-wheel {
0%{-o-transform: rotate(0deg); opacity: 1;}
100% {-o-transform: rotate(360deg); opacity: 1;}
}
#-o-keyframes fade-in {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-o-keyframes mask-in {
0% {background-position: 0 -50px; opacity: 0;}
100% {background-position: 0 -25px; opacity: 1;}
}
#-o-keyframes rotate-arm {
0%{-o-transform: rotate(0deg); -o-transform-origin: 0% 0%; opacity: 1;}
100% {-o-transform: rotate(-10deg); -o-transform-origin: 0% 0%; opacity: 1;}
}
/* STANDARD */
#-keyframes frame-animation {
0% {background-position: 0 0; }
100% {background-position: 0 -4920px; }
}
#-keyframes frame-girl-1 {
0% {background-position: 0 0; }
100% {background-position: -364px 0; }
}
#-keyframes frame-girl-2 {
0% {background-position: 0 0; opacity: 1; }
100% {background-position: -364px 0; opacity: 1; }
}
#-keyframes frame-clock-lamp {
0% {background-position: 0 0;}
100% {background-position: -660px 0;}
}
#-keyframes move-left {
from {-transform: translateX(0);}
to {-transform: translateX(-250px);}
}
#-keyframes frame-desk-car {
0% {background-position: 0 0;}
100% {background-position: 0 -2418px;}
}
#-keyframes frame-window {
0% {background-position: 0 0;}
100% {background-position: -354px 0;}
}
#-keyframes roll-wheel {
0%{-transform: rotate(0deg); opacity: 1;}
100% {-transform: rotate(360deg); opacity: 1;}
}
#-keyframes fade-in {
0% {opacity: 0;}
100% {opacity: 1;}
}
#-keyframes mask-in {
0% {background-position: 0 -50px; opacity: 0;}
100% {background-position: 0 -25px; opacity: 1;}
}
#-keyframes rotate-arm {
0%{-transform: rotate(0deg); -transform-origin: 0% 0%; opacity: 1;}
100% {-transform: rotate(-10deg); -transform-origin: 0% 0%; opacity: 1;}
}
<div id="ad">
<div id="banner">
<div id="headline1">
</div>
<div id="headline2">
</div>
<div id="tag-line">
</div>
<div id="wheel-l">
</div>
<div id="wheel-r">
</div>
<div id="desk-car">
</div>
<div id="girl-arm">
</div>
<div id="girl-1">
</div>
<div id="girl-2">
</div>
<br>
<div id="clock-lamp">
</div>
<div id="clock2">
</div>
<div id="window-l">
</div>
<div id="window-r">
</div>
<div class="sub-copy">To enter, open a CommSec International Account and <br/> place a trade from <strong>US$19.95</strong>.
</div>
<div id="dis">
</div>
<div class="buttons">
<button id="clickthrough-button" class="button clickthrough">Find out more »
</button>
</div>
<div id="logo"></div>
</div>
</div>
-webkit-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-moz-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-ms-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-o-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
The above CSS is for wheel animation which is not working in Chrome. Can someone help me how can I fix the Chrome wheel spinning issue. This is the JSFiddle version.
The screencast showing I am seeing this in Chrome.

This seems to be a bug in older versions of Chrome (seen till v38) which seems to have got fixed now (based on the comments to question). However, you need to make note of the following things:
The roll wheel animation has a duration of 1.5s and is supposed to start after a delay of 3.3s. The animation has 5 iterations and so this whole animation would effectively complete only after 10.8s from start (3.3s + (1.5s * 5)).
The fade-in animation has a duration of .1s and is supposed to start after a delay of 6s. Because of this animation, the element is supposed to have faded out of view at 6.1s mark. (But this is not happening due to some bug in older versions).
Now, if you look carefully, at 6.1s not even 2 iterations of the roll wheel animation would have got completed and hence the iteration count that is set doesn't really make much sense and it needs to be reduced but even if we reduce it to 2, the animation would end only at 6.3s. So, change the duration of roll wheel animation to 1.4s and set the iteration count to just 2. This should fix it.
In the below snippet, I have made the change only for -webkit-animation but this should work in all browsers. I had tested in Chrome, Firefox but please test it out before modifying the others.
Now coming to the bug itself, ideally, when more than one animation is modifying the same property then the one that is specified last should take priority. So, in this case the opacity change within the fade-in animation should have taken priority and faded out the wheels but it is not happening. So, the only solution we are left with is to modify the duration and iteration of roll wheel animation in order to make sure that it completes at the same time the fade-in completes.
As per W3C Spec
If at one point in time there are multiple animations specifying behavior for the same property, the animation which occurs last in the value of animation-name will override the other animations at that point.
body {
font-family: Helvetica, Arial, sans-serif;
margin: 0px;
}
#headline1,
#headline2 {
background-image: url(http://i.share.pho.to/6846bb0a_o.png);
background-repeat: no-repeat;
width: 261px;
height: 25px;
position: absolute;
top: 20px;
left: 20px;
}
#headline1 {
-webkit-animation: fade-in .1s ease 6s 1 reverse forwards;
-moz-animation: fade-in .1s ease 6s 1 reverse forwards;
-o-animation: fade-in .1s ease 6s 1 reverse forwards;
animation: fade-in .1s ease 6s 1 reverse forwards;
}
#headline2 {
background-position: 0px -25px;
top: 40px;
-webkit-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
-moz-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
-o-animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
animation: mask-in .5s ease-out 3s 1 normal both, fade-in .1s linear 6s 1 reverse both;
}
button {
background: #FFCB05;
height: 34px;
width: 130px;
border: none;
z-index: 999;
border-radius: 17px;
color: #000;
cursor: pointer;
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
outline: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
user-select: none;
-webkit-animation: fade-in 1s ease 7s 1 both;
-moz-animation: fade-in 1s ease 7s 1 both;
-o-animation: fade-in 1s ease 7s 1 both;
animation: fade-in 1s ease 7s 1 both;
}
button:hover,
button:active {
background-color: #FFD716;
}
.sub-copy {
color: #FFF;
position: absolute;
margin-left: 25px;
top: 40px;
-webkit-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-moz-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-o-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
}
#dis {
background-image: url(http://i.share.pho.to/4516683d_o.jpeg);
background-repeat: no-repeat;
width: 138px;
height: 19px;
position: absolute;
margin-left: 22px;
top: 206px;
-webkit-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-moz-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
-o-animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
animation: fade-in 1s ease 6s 1 both, fade-in .5s ease 10s 1 reverse forwards;
}
#logo {
background-image: url(http://i.share.pho.to/306d2b9c_o.png);
background-repeat: no-repeat;
width: 103px;
height: 26px;
position: absolute;
bottom: 20px;
right: 20px;
}
#tag-line {
background-image: url(http://i.share.pho.to/e62322ba_o.jpeg);
background-repeat: no-repeat;
width: 207px;
height: 40px;
position: absolute;
bottom: 153px;
left: 14px;
-webkit-animation: fade-in 1s ease 10.5s 1 both;
-moz-animation: fade-in 1s ease 10.5s 1 both;
-o-animation: fade-in 1s ease 10.5s 1 both;
animation: fade-in 1s ease 10.5s 1 both;
}
#girl-arm {
position: absolute;
top: 141px;
left: 133px;
width: 9px;
height: 5px;
z-index: 7;
opacity: 0;
background-image: url(http://i.share.pho.to/5a840ac3_o.gif);
background-repeat: no-repeat;
background-position: -37px -34px;
-webkit-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
-moz-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
-o-animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
animation: rotate-arm .15s ease-out .5s 10 alternate none, fade-in .01s ease 2s 1 reverse forwards;
}
#girl-1 {
position: absolute;
top: 107px;
left: 96px;
width: 84px;
height: 85px;
background-image: url(http://i.share.pho.to/5a840ac3_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#clock-lamp {
position: absolute;
top: 104px;
left: 184px;
width: 24px;
height: 88px;
background-image: url(http://i.share.pho.to/d264b4e6_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#clock2 {
position: absolute;
top: 74px;
left: 181px;
width: 29px;
height: 117px;
background-image: url(http://i.share.pho.to/24b90b3c_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-moz-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-o-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
-ms-animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
animation: fade-in 1s ease 3s 1 both, move-left 11s ease 3s 1 both, fade-in .5s ease 5.8s 1 reverse forwards;
}
#desk-car {
position: absolute;
top: 102px;
left: 33px;
width: 204px;
height: 90px;
z-index: 5;
background-image: url(http://i.share.pho.to/0c2e3ceb_o.png);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
-moz-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
-o-animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
animation: fade-in 1s ease 3s 1 both, fade-in .5s ease 6s 1 reverse forwards;
}
#window-l,
#window-r {
position: absolute;
top: 79px;
width: 59px;
height: 69px;
background-image: url(http://i.share.pho.to/4bf00ac7_o.gif);
background-repeat: no-repeat;
-webkit-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-moz-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
-o-animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
animation: fade-in 1s ease .1s 1 both, fade-in .7s ease 3s 1 reverse forwards;
}
#window-l {
left: 18px;
}
#window-r {
left: 218px;
}
#wheel-l,
#wheel-r {
position: absolute;
top: 157px;
width: 32px;
height: 33px;
opacity: 0;
z-index: 9;
background-image: url(http://i.share.pho.to/08185b2c_o.png);
background-repeat: no-repeat;
-webkit-animation: roll-wheel 1.4s linear 3.3s 2 none, fade-in .1s ease 6s 1 reverse forwards;
-moz-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
-o-animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
animation: roll-wheel 1.5s linear 3.3s 5 none, fade-in .1s ease 6s 1 reverse forwards;
}
#wheel-l {
left: 57px;
}
#wheel-r {
left: 184px;
}
#ad {
display: block;
border: rgb(145, 153, 153) 1px solid;
overflow: hidden;
cursor: pointer;
width: 298px;
height: 248px;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
#banner {
position: absolute;
display: block;
width: 300px;
height: 250px;
background-color: #000;
background-position: 0px 0px;
background-repeat: no-repeat;
overflow: hidden;
}
.buttons {
position: absolute;
z-index: 20;
top: 110px;
left: 20px;
}
/* ANIMATIONS */
/* WEBKIT */
#-webkit-keyframes frame-animation {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -4920px;
}
}
#-webkit-keyframes frame-girl-1 {
0% {
background-position: 0 0;
}
100% {
background-position: -364px 0;
}
}
#-webkit-keyframes frame-girl-2 {
0% {
background-position: 0 0;
opacity: 1;
}
100% {
background-position: -364px 0;
opacity: 1;
}
}
#-webkit-keyframes frame-clock-lamp {
0% {
background-position: 0 0;
}
100% {
background-position: -660px 0;
}
}
#-webkit-keyframes move-left {
from {
-webkit-transform: translateX(0);
}
to {
-webkit-transform: translateX(-250px);
}
}
#-webkit-keyframes frame-desk-car {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -2418px;
}
}
#-webkit-keyframes frame-window {
0% {
background-position: 0 0;
}
100% {
background-position: -354px 0;
}
}
#-webkit-keyframes roll-wheel {
0% {
-webkit-transform: rotate(0deg);
opacity: 1;
}
100% {
-webkit-transform: rotate(360deg);
opacity: 1;
}
}
#-webkit-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-webkit-keyframes mask-in {
0% {
background-position: 0 -50px;
opacity: 0;
}
100% {
background-position: 0 -25px;
opacity: 1;
}
}
#-webkit-keyframes rotate-arm {
0% {
-webkit-transform: rotate(0deg);
-webkit-transform-origin: 0% 0%;
opacity: 1;
}
100% {
-webkit-transform: rotate(-10deg);
-webkit-transform-origin: 0% 0%;
opacity: 1;
}
}
/* MOZ */
#-moz-keyframes frame-animation {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -4920px;
}
}
#-moz-keyframes frame-girl-1 {
0% {
background-position: 0 0;
}
100% {
background-position: -364px 0;
}
}
#-moz-keyframes frame-girl-2 {
0% {
background-position: 0 0;
opacity: 1;
}
100% {
background-position: -364px 0;
opacity: 1;
}
}
#-moz-keyframes frame-clock-lamp {
0% {
background-position: 0 0;
}
100% {
background-position: -660px 0;
}
}
#-moz-keyframes move-left {
from {
-moz-transform: translateX(0);
}
to {
-moz-transform: translateX(-250px);
}
}
#-moz-keyframes frame-desk-car {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -2418px;
}
}
#-moz-keyframes frame-window {
0% {
background-position: 0 0;
}
100% {
background-position: -354px 0;
}
}
#-moz-keyframes roll-wheel {
0% {
-moz-transform: rotate(0deg);
opacity: 1;
}
100% {
-moz-transform: rotate(360deg);
opacity: 1;
}
}
#-moz-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-moz-keyframes mask-in {
0% {
background-position: 0 -50px;
opacity: 0;
}
100% {
background-position: 0 -25px;
opacity: 1;
}
}
#-moz-keyframes rotate-arm {
0% {
-moz-transform: rotate(0deg);
-moz-transform-origin: 0% 0%;
opacity: 1;
}
100% {
-moz-transform: rotate(-10deg);
-moz-transform-origin: 0% 0%;
opacity: 1;
}
}
/* ms */
#-ms-keyframes frame-animation {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -4920px;
}
}
#-ms-keyframes frame-girl-1 {
0% {
background-position: 0 0;
}
100% {
background-position: -364px 0;
}
}
#-ms-keyframes frame-girl-2 {
0% {
background-position: 0 0;
opacity: 1;
}
100% {
background-position: -364px 0;
opacity: 1;
}
}
#-ms-keyframes frame-clock-lamp {
0% {
background-position: 0 0;
}
100% {
background-position: -660px 0;
}
}
#-ms-keyframes move-left {
from {
-ms-transform: translateX(0);
}
to {
-ms-transform: translateX(-250px);
}
}
#-ms-keyframes frame-desk-car {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -2418px;
}
}
#-ms-keyframes frame-window {
0% {
background-position: 0 0;
}
100% {
background-position: -354px 0;
}
}
#-ms-keyframes roll-wheel {
0% {
-ms-transform: rotate(0deg);
opacity: 1;
}
100% {
-ms-transform: rotate(360deg);
opacity: 1;
}
}
#-ms-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-ms-keyframes mask-in {
0% {
background-position: 0 -50px;
opacity: 0;
}
100% {
background-position: 0 -25px;
opacity: 1;
}
}
#-ms-keyframes rotate-arm {
0% {
-ms-transform: rotate(0deg);
-ms-transform-origin: 0% 0%;
opacity: 1;
}
100% {
-ms-transform: rotate(-10deg);
-ms-transform-origin: 0% 0%;
opacity: 1;
}
}
/* O */
#-o-keyframes frame-animation {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -4920px;
}
}
#-o-keyframes frame-girl-1 {
0% {
background-position: 0 0;
}
100% {
background-position: -364px 0;
}
}
#-o-keyframes frame-girl-2 {
0% {
background-position: 0 0;
opacity: 1;
}
100% {
background-position: -364px 0;
opacity: 1;
}
}
#-o-keyframes frame-clock-lamp {
0% {
background-position: 0 0;
}
100% {
background-position: -660px 0;
}
}
#-o-keyframes move-left {
from {
-o-transform: translateX(0);
}
to {
-o-transform: translateX(-250px);
}
}
#-o-keyframes frame-desk-car {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -2418px;
}
}
#-o-keyframes frame-window {
0% {
background-position: 0 0;
}
100% {
background-position: -354px 0;
}
}
#-o-keyframes roll-wheel {
0% {
-o-transform: rotate(0deg);
opacity: 1;
}
100% {
-o-transform: rotate(360deg);
opacity: 1;
}
}
#-o-keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#-o-keyframes mask-in {
0% {
background-position: 0 -50px;
opacity: 0;
}
100% {
background-position: 0 -25px;
opacity: 1;
}
}
#-o-keyframes rotate-arm {
0% {
-o-transform: rotate(0deg);
-o-transform-origin: 0% 0%;
opacity: 1;
}
100% {
-o-transform: rotate(-10deg);
-o-transform-origin: 0% 0%;
opacity: 1;
}
}
/* STANDARD */
#keyframes frame-animation {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -4920px;
}
}
#keyframes frame-girl-1 {
0% {
background-position: 0 0;
}
100% {
background-position: -364px 0;
}
}
#keyframes frame-girl-2 {
0% {
background-position: 0 0;
opacity: 1;
}
100% {
background-position: -364px 0;
opacity: 1;
}
}
#keyframes frame-clock-lamp {
0% {
background-position: 0 0;
}
100% {
background-position: -660px 0;
}
}
#keyframes move-left {
from {
transform: translateX(0);
}
to {
transform: translateX(-250px);
}
}
#keyframes frame-desk-car {
0% {
background-position: 0 0;
}
100% {
background-position: 0 -2418px;
}
}
#keyframes frame-window {
0% {
background-position: 0 0;
}
100% {
background-position: -354px 0;
}
}
#keyframes roll-wheel {
0% {
transform: rotate(0deg);
opacity: 1;
}
100% {
transform: rotate(360deg);
opacity: 1;
}
}
#keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes mask-in {
0% {
background-position: 0 -50px;
opacity: 0;
}
100% {
background-position: 0 -25px;
opacity: 1;
}
}
#keyframes rotate-arm {
0% {
transform: rotate(0deg);
transform-origin: 0% 0%;
opacity: 1;
}
100% {
transform: rotate(-10deg);
transform-origin: 0% 0%;
opacity: 1;
}
}
<div id="ad">
<div id="banner">
<div id="headline1">
</div>
<div id="headline2">
</div>
<div id="tag-line">
</div>
<div id="wheel-l">
</div>
<div id="wheel-r">
</div>
<div id="desk-car">
</div>
<div id="girl-arm">
</div>
<div id="girl-1">
</div>
<div id="girl-2">
</div>
<br>
<div id="clock-lamp">
</div>
<div id="clock2">
</div>
<div id="window-l">
</div>
<div id="window-r">
</div>
<div class="sub-copy">To enter, open a CommSec International Account and
<br/>place a trade from <strong>US$19.95</strong>.
</div>
<div id="dis">
</div>
<div class="buttons">
<button id="clickthrough-button" class="button clickthrough">Find out more »
</button>
</div>
<div id="logo"></div>
</div>
</div>

Related

Use only css transform translate to control animation instead of margin and other non-optimization

I am trying to recreate this animation using using transform translate properties. The animation use margin to control the animation and that is not optimize. It can cause stutter. How would you accomplish that using transform translate?
He is the original source of the code: enter link description here
<style>
body {
background: #00b4ff;
color: #333;
font: 100% Lato, Arial, Sans Serif;
height: 100vh;
margin: 0;
padding: 0;
overflow-x: hidden;
}
#background-wrap {
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
z-index: -1;
}
/* KEYFRAMES */
#-webkit-keyframes animateBubble {
0% {
margin-top: 1000px;
}
100% {
margin-top: -100%;
}
}
#-moz-keyframes animateBubble {
0% {
margin-top: 1000px;
}
100% {
margin-top: -100%;
}
}
#keyframes animateBubble {
0% {
margin-top: 1000px;
}
100% {
margin-top: -100%;
}
}
#-webkit-keyframes sideWays {
0% {
margin-left:0px;
}
100% {
margin-left:50px;
}
}
#-moz-keyframes sideWays {
0% {
margin-left:0px;
}
100% {
margin-left:50px;
}
}
#keyframes sideWays {
0% {
margin-left:0px;
}
100% {
margin-left:50px;
}
}
/* ANIMATIONS */
.x1 {
-webkit-animation: animateBubble 25s linear infinite, sideWays 2s ease-in-out infinite alternate;
-moz-animation: animateBubble 25s linear infinite, sideWays 2s ease-in-out infinite alternate;
animation: animateBubble 25s linear infinite, sideWays 2s ease-in-out infinite alternate;
left: -5%;
top: 5%;
-webkit-transform: scale(0.6);
-moz-transform: scale(0.6);
transform: scale(0.6);
}
.x2 {
-webkit-animation: animateBubble 20s linear infinite, sideWays 4s ease-in-out infinite alternate;
-moz-animation: animateBubble 20s linear infinite, sideWays 4s ease-in-out infinite alternate;
animation: animateBubble 20s linear infinite, sideWays 4s ease-in-out infinite alternate;
left: 5%;
top: 80%;
-webkit-transform: scale(0.4);
-moz-transform: scale(0.4);
transform: scale(0.4);
}
.x3 {
-webkit-animation: animateBubble 28s linear infinite, sideWays 2s ease-in-out infinite alternate;
-moz-animation: animateBubble 28s linear infinite, sideWays 2s ease-in-out infinite alternate;
animation: animateBubble 28s linear infinite, sideWays 2s ease-in-out infinite alternate;
left: 10%;
top: 40%;
-webkit-transform: scale(0.7);
-moz-transform: scale(0.7);
transform: scale(0.7);
}
.x4 {
-webkit-animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
-moz-animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
left: 20%;
top: 0;
-webkit-transform: scale(0.3);
-moz-transform: scale(0.3);
transform: scale(0.3);
}
.x5 {
-webkit-animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
-moz-animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
left: 30%;
top: 50%;
-webkit-transform: scale(0.5);
-moz-transform: scale(0.5);
transform: scale(0.5);
}
.x6 {
-webkit-animation: animateBubble 21s linear infinite, sideWays 2s ease-in-out infinite alternate;
-moz-animation: animateBubble 21s linear infinite, sideWays 2s ease-in-out infinite alternate;
animation: animateBubble 21s linear infinite, sideWays 2s ease-in-out infinite alternate;
left: 50%;
top: 0;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
transform: scale(0.8);
}
.x7 {
-webkit-animation: animateBubble 20s linear infinite, sideWays 2s ease-in-out infinite alternate;
-moz-animation: animateBubble 20s linear infinite, sideWays 2s ease-in-out infinite alternate;
animation: animateBubble 20s linear infinite, sideWays 2s ease-in-out infinite alternate;
left: 65%;
top: 70%;
-webkit-transform: scale(0.4);
-moz-transform: scale(0.4);
transform: scale(0.4);
}
.x8 {
-webkit-animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
-moz-animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
animation: animateBubble 22s linear infinite, sideWays 3s ease-in-out infinite alternate;
left: 80%;
top: 10%;
-webkit-transform: scale(0.3);
-moz-transform: scale(0.3);
transform: scale(0.3);
}
.x9 {
-webkit-animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
-moz-animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
animation: animateBubble 29s linear infinite, sideWays 4s ease-in-out infinite alternate;
left: 90%;
top: 50%;
-webkit-transform: scale(0.6);
-moz-transform: scale(0.6);
transform: scale(0.6);
}
.x10 {
-webkit-animation: animateBubble 26s linear infinite, sideWays 2s ease-in-out infinite alternate;
-moz-animation: animateBubble 26s linear infinite, sideWays 2s ease-in-out infinite alternate;
animation: animateBubble 26s linear infinite, sideWays 2s ease-in-out infinite alternate;
left: 80%;
top: 80%;
-webkit-transform: scale(0.3);
-moz-transform: scale(0.3);
transform: scale(0.3);
}
/* OBJECTS */
.bubble {
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2), inset 0px 10px 30px 5px rgba(255, 255, 255, 1);
-moz-box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2), inset 0px 10px 30px 5px rgba(255, 255, 255, 1);
box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2), inset 0px 10px 30px 5px rgba(255, 255, 255, 1);
height: 200px;
position: absolute;
width: 200px;
}
.bubble:after {
background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 70%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,0.5)), color-stop(70%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 70%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 70%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 70%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(255,255,255,0.5) 0%,rgba(255,255,255,0) 70%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#80ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.3);
-moz-box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.3);
box-shadow: inset 0 20px 30px rgba(255, 255, 255, 0.3);
content: "";
height: 180px;
left: 10px;
position: absolute;
width: 180px;
}
</style>
<div id="background-wrap">
<div class="bubble x1"></div>
<div class="bubble x2"></div>
<div class="bubble x3"></div>
<div class="bubble x4"></div>
<div class="bubble x5"></div>
<div class="bubble x6"></div>
<div class="bubble x7"></div>
<div class="bubble x8"></div>
<div class="bubble x9"></div>
<div class="bubble x10"></div>
</div>
You can use the following keyframe code in your css. Make sure to prefix the keyframes and the transform property as well.
.bubble {
margin-top: 1000px;
margin-left: 0px;
}
#keyframes animateBubble {
0% {
transform: translateY(0px);
}
100% {
transform: translateY(-2000px);
}
}
#keyframes sideWays {
0% {
transform: translateX(0px);
}
100% {
transform: translateX(50px);
}
}
Thanks to a choice made about transform and how they work without thinking about having transform defined by the properties you can set on it and not having the properties only be set on one define transform on that element. I was hoping of someone showing me the same effect as the code in the pin with the motion. You can use the following keyframe code in your css to get the bubble to move up and swing side to side but getting that smooth motion like you see is another story.
#keyframes animateBubble {
0% {
transform: translate(0px -50vh);
}
100% {
transform: translate(5px 100vh);
}
}

Cross fading between three divs in CSS

I've been working on cross-fading between three different images for a "twinkling" effect, but discovered I actually need to do this with three different divs so I can use the "background-repeat" property. The problem is I can't seem to figure out how to modify the code to work with divs instead of images.
Here's the code I've been using that works with images:
CSS:
#-webkit-keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#-moz-keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#starrysky img {
position: top left fixed;
width:900px;
}
#starrysky img:nth-child(2) {
opacity: .9;
-webkit-animation: twinkle 1.25s ease-in alternate infinite;
-moz-animation: twinkle 1.25s ease-in alternate infinite;
animation: twinkle 1.25s ease-in alternate infinite;
transition-delay: 2s;
}
#starrysky img:nth-child(3) {
opacity: .9;
-webkit-animation: twinkle 1.75s ease-in alternate infinite;
-moz-animation: twinkle 1.75s ease-in alternate infinite;
animation: twinkle 1.75s ease-in alternate infinite;
transition-delay: 3s;
}
#starrysky img:nth-child(4) {
opacity: .7;
-webkit-animation: twinkle 2.5s ease-in alternate infinite;
-moz-animation: twinkle 2.5s ease-in alternate infinite;
animation: twinkle 2.5s ease-in alternate infinite;
transition-delay: 2s;
}
and HTML:
<div id="starrysky">
<img src="arcticnomoon1.jpg;">
<img src="arcticnomoon2.jpg">
<img src="arcticnomoon3.jpg">
</div>
Any help would be much appreciated! I'm hoping to be able to do this without jQuery, or if I must, very simple jQuery. :\
Well you are on the right track, you're just positioning the images in the #starrysky div a bit wrong :)
Here's an example
#-webkit-keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#-moz-keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#keyframes twinkle {
from { opacity: 0; }
to { opacity: 1; }
}
#starrysky {
position: relative;
width: 300px;
height: 200px;
overflow: hidden;
}
#starrysky img {
position: absolute;
left: 0;
top: 0;
width: 100%;
}
#starrysky img{
opacity: .9;
-webkit-animation: twinkle 1.25s ease-in alternate infinite;
-moz-animation: twinkle 1.25s ease-in alternate infinite;
animation: twinkle 1.25s ease-in alternate infinite;
transition-delay: 2s;
}
#starrysky img:nth-child(2) {
opacity: .9;
-webkit-animation: twinkle 1.75s ease-in alternate infinite;
-moz-animation: twinkle 1.75s ease-in alternate infinite;
animation: twinkle 1.75s ease-in alternate infinite;
transition-delay: 3s;
}
<div id="starrysky">
<img src="http://www.southernhillsanimalhospital.com/sites/site-1450/images/kittens.jpg" />
<img src="http://dreamatico.com/data_images/kitten/kitten-2.jpg" />
</div>

html css cross fade timer

i have this simple web page and what i want to do is to fade in the first pic for 5 seconds then change it to picture # 2 for 5 seconds as well. here is my code:
<!DOCTYPE html>
<html>
<style>
#cf {
position:relative;
height:281px;
width:450px;
margin:0 auto;
}
#cf img {
position:absolute;
left:0;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
#keyframes cf3FadeInOut {
0% {
opacity:1;
}
45% {
opacity:1;
}
55% {
opacity:0;
}
100% {
opacity:0;
}
}
#cf img.top {
animation-name: cf3FadeInOut;
animation-timing-function: ease-in-out;
animation-iteration-count: 30s;
animation-duration: 10s;
animation-direction: alternate;
}
}
</style>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="fade.css">
<title>Wideout</title>
</head>
<body>
<iframe width="560" height="315"
src="https://www.youtube.com/embed/seMwpP0yeu4"
frameborder="0" allowfullscreen></iframe>
<div id="cf">
<img class="bottom" src="images/1.jpg" height="100" />
<img class="top" src="images/2.jpg" height="100" />
</div>
</body>
</html>
i do believe my problem is with the percentage part. can someon help me out? much appreciated
This can be done just using CSS3
#crossfade > img {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
color: transparent;
opacity: 0;
z-index: 0;
-webkit-backface-visibility: hidden;
-webkit-animation: imageAnimation 30s linear infinite 0s;
-moz-animation: imageAnimation 30s linear infinite 0s;
-o-animation: imageAnimation 30s linear infinite 0s;
-ms-animation: imageAnimation 30s linear infinite 0s;
animation: imageAnimation 30s linear infinite 0s;
}
#crossfade > img:nth-child(2) {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
#-webkit-keyframes imageAnimation {
0% { opacity: 0;
-webkit-animation-timing-function: ease-in; }
8% { opacity: 1;
-webkit-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-moz-keyframes imageAnimation {
0% { opacity: 0;
-moz-animation-timing-function: ease-in; }
8% { opacity: 1;
-moz-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-o-keyframes imageAnimation {
0% { opacity: 0;
-o-animation-timing-function: ease-in; }
8% { opacity: 1;
-o-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#-ms-keyframes imageAnimation {
0% { opacity: 0;
-ms-animation-timing-function: ease-in; }
8% { opacity: 1;
-ms-animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
#keyframes imageAnimation {
0% { opacity: 0;
animation-timing-function: ease-in; }
8% { opacity: 1;
animation-timing-function: ease-out; }
17% { opacity: 1 }
25% { opacity: 0 }
100% { opacity: 0 }
}
Check
Here's a JSFiddle

CSS Image animation works in all browsers BUT safari

I am using CSS to flip images to make them look like they flip in.
This works in all browsers but safari. Please open this link in chrome or firefox where it appears correctly, then please open it in safari:
http://project-awesome.id-staging.com/SO-test/index.html
Here is my CSS:
KEYFRAMES
#-moz-keyframes spin { 100% {opacity:1; -moz-transform: rotateY(180deg); } }
#-webkit-keyframes spin { 100% {opacity:1; -webkit-transform: rotateY(180deg); } }
#keyframes spin { 100% {opacity:1; -webkit-transform: rotateY(180deg); transform:rotateY(180deg); } }
#-moz-keyframes spin2 { 100% {opacity:1; -moz-transform: rotateY(180deg); } }
#-webkit-keyframes spin2 { 100% {opacity:1; transform:rotateY(-180deg); -webkit-transform-origin:100% 0 0; transform-origin:100% 0 0; } }
#keyframes spin2 { 100% {opacity:1; transform:rotateY(-180deg); -webkit-transform-origin:100% 0 0; transform-origin:100% 0 0; } }
#-moz-keyframes spin3 { 100% { opacity:1; transform:rotateX(-180deg); -webkit-transform-origin:0 100% 0; transform-origin:0 100% 0; } }
#-webkit-keyframes spin3 { 100% { opacity:1; transform:rotateX(-180deg); -webkit-transform-origin:0 100% 0; transform-origin:0 100% 0; } }
#keyframes spin3 { 100% { opacity:1; transform:rotateX(-180deg); -webkit-transform-origin:0 100% 0; transform-origin: 0 100% 0; } }
#-moz-keyframes spin5 { 100% { opacity:1; transform:rotateX(180deg); -webkit-transform-origin: 0 0 100% 0; transform-origin:100% 0 0 } }
#-webkit-keyframes spin5 { 100% { opacity:1; transform:rotateX(180deg); -webkit-transform-origin:0 0 100% 0; transform-origin:0 0 100% 0; } }
#keyframes spin5 { 100% { opacity:1; transform:rotateX(180deg); -webkit-transform-origin: 0 0 100% 0 ; transform-origin: 0 0 100% 0; } }
#-moz-keyframes spin4 { 100% {opacity:1; -moz-transform: rotateY(-180deg); } }
#-webkit-keyframes spin4 { 100% {opacity:1; transform:rotateY(-180deg); -webkit-transform-origin:100% 0 0; transform-origin:0 100% 0; } }
#keyframes spin4 { 100% {opacity:1; transform:rotateY(-180deg); -webkit-transform-origin:100% 0 0; transform-origin:0 100% 0; } }
Each image flip:
.front-1 {
position: absolute;
left: -65px;
top: 54px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin2 0.5s 0.5s linear forwards;
-moz-animation:spin2 0.5s 0.5s linear forwards;
animation:spin2 0.5s 0.5s linear forwards;
}
.front-2 {
position: absolute;
left: 7px;
top: 54px;
width: 72px;
height: 72px;
z-index:-94;
opacity:0;
-webkit-animation:spin2 0.5s 1.2s linear forwards;
-moz-animation:spin2 0.5s 1.2s linear forwards;
animation:spin2 0.5s 1.2s linear forwards;
}
.front-3 {
position: absolute;
left: -65px;
top: 374px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin2 0.5s 1.5s linear forwards;
-moz-animation:spin2 0.5s 1.5s linear forwards;
animation:spin2 0.5s 1.5s linear forwards;
}
.front-4 {
position: absolute;
left: 7px;
top: 374px;
width: 72px;
height: 72px;
z-index:-95;
opacity:0;
-webkit-animation: spin2 0.5s 2.0s linear forwards;
-moz-animation:spin2 0.5s 2.0s linear forwards;
animation:spin2 0.5s 2.0s linear forwards;
}
.front-5 {
position: absolute;
left: 79px;
top: 446px;
width: 72px;
height: 72px;
opacity:0;
}
.front-6 {
position: absolute;
left: 79px;
top: 374px;
width: 72px;
height: 72px;
z-index:-96;
opacity: 0;
-webkit-animation:spin3 0.5s 2.5s linear forwards;
-moz-animation:spin3 .0.5s 2.5s linear forwards;
animation:spin3 0.5s 2.5s linear forwards;
}
.front-7 {
position: absolute;
left: 79px;
top: 518px;
width: 72px;
height: 72px;
z-index:-99;
opacity:0;
-webkit-animation:spin4 0.5s 3.5s linear forwards;
-moz-animation:spin4 0.5s 3.5s linear forwards;
animation:spin4 0.5s 3.5s linear forwards;
}
.front-8 {
position: absolute;
left: 79px;
top: 446px;
width: 72px;
height: 72px;
z-index:-98;
opacity:0;
-webkit-animation:spin3 0.5s 3.0s linear forwards;
-moz-animation:spin3 0.5s 3.0s linear forwards;
animation:spin3 0.5s 3.0s linear forwards;
}
/* BACK IMAGE CLASSES */
.back-1 {
position: absolute;
left: 79px;
top: 54px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin 0.5s 7s linear forwards;
-moz-animation:spin 0.5s 7s linear forwards;
animation:spin 0.5s 7s linear forwards;
}
.back-2 {
position: absolute;
left: 79px;
top: 54px;
width: 72px;
height: 72px;
opacity:0;
}
.back-3 {
position: absolute;
left: 79px;
top: 374px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin4 0.5s 5.5s linear forwards;
-moz-animation:spin4 0.5s 5.5s linear forwards;
animation:spin4 0.5s 5.5s linear forwards;
}
.back-4 {
position: absolute;
left: 79px;
top: 374px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin5 0.5s 6s linear forwards;
-moz-animation:spin5 0.5s 6s linear forwards;
animation:spin5 0.5s 6s linear forwards;
}
.back-5 {
position: absolute;
left: 7px;
top: 446px;
width: 72px;
height: 72px;
opacity:0;
}
.back-6 {
position: absolute;
left: 79px;
top: 446px;
width: 72px;
height: 72px;
opacity:0;
-webkit-animation:spin5 0.5s 4.5s linear forwards;
-moz-animation:spin5 0.5s 4.5s linear forwards;
animation:spin5 0.5s 4.5s linear forwards;
}
.back-7 {
position: absolute;
left: 7px;
top: 518px;
width: 72px;
height: 72px;
opacity:0;
z-index:80;
-webkit-animation:spin 0.5s 4s linear forwards;
-moz-animation:spin 0.5s 4s linear forwards;
animation:spin 0.5s 4s linear forwards;
}
.back-8 {
position: absolute;
left: 7px;
top: 518px;
width: 72px;
height: 72px;
opacity:0;
z-index:-81;
-webkit-animation:spin2 0.5s 5s linear forwards;
-moz-animation:spin2 0.5s 5s linear forwards;
animation:spin2 0.5s 5s linear forwards;
}
Any ideas are highly appreciated.
Thanks in advance
you forgot the -webkit- prefix in some of your transforms in the #-webkit-keyframes blocks.
i wont go over everything, but you should lookup sections like this:
#-webkit-keyframes spin2 {
100% {
opacity:1;
transform:rotateY(-180deg);
-webkit-transform-origin:100% 0 0;
transform-origin:100% 0 0;
}
}
and add the -webkit- prefix to the rotation transformation as well.

Imitating a blink tag with CSS3 animations

I really want to make a piece of text blink the old-school style without using javascript or text-decoration.
No transitions, only *blink*, *blink*, *blink*!
This is different from that question because I ask for blinking without continuous transitions, whereas OP of the other questions asks how to replace blinking with continuous transitions
The original Netscape <blink> had an 80% duty cycle. This comes pretty close, although the real <blink> only affects text:
.blink {
animation: blink-animation 1s steps(5, start) infinite;
-webkit-animation: blink-animation 1s steps(5, start) infinite;
}
#keyframes blink-animation {
to {
visibility: hidden;
}
}
#-webkit-keyframes blink-animation {
to {
visibility: hidden;
}
}
This is <span class="blink">blinking</span> text.
You can find more info about Keyframe Animations here.
Let me show you a little trick.
As Arkanciscan said, you can use CSS3 transitions. But his solution looks different from the original tag.
What you really need to do is this:
#keyframes blink {
50% {
opacity: 0.0;
}
}
.blink {
animation: blink 1s step-start 0s infinite;
}
<span class="blink">Blink</span>
JSfiddle Demo
Try this CSS
#keyframes blink {
0% { color: red; }
100% { color: black; }
}
#-webkit-keyframes blink {
0% { color: red; }
100% { color: black; }
}
.blink {
-webkit-animation: blink 1s linear infinite;
-moz-animation: blink 1s linear infinite;
animation: blink 1s linear infinite;
}
This is <span class="blink">blink</span>
​
You need browser/vendor specific prefixes: http://jsfiddle.net/es6e6/1/.
There's actually no need for visibility or opacity - you can simply use color, which has the upside of keeping any "blinking" to the text only:
blink {
display: inline;
color: inherit;
animation: blink 1s steps(1) infinite;
-webkit-animation: blink 1s steps(1) infinite;
}
#keyframes blink { 50% { color: transparent; } }
#-webkit-keyframes blink { 50% { color: transparent; } }
Here is some text, <blink>this text will blink</blink>, this will not.
Fiddle: http://jsfiddle.net/2r8JL/
I'm going to hell for this :
=keyframes($name)
#-webkit-keyframes #{$name}
#content
#-moz-keyframes #{$name}
#content
#-ms-keyframes #{$name}
#content
#keyframes #{$name}
#content
+keyframes(blink)
25%
zoom: 1
opacity: 1
65%
opacity: 1
66%
opacity: 0
100%
opacity: 0
body
font-family: sans-serif
font-size: 4em
background: #222
text-align: center
.blink
color: rgba(#fff, 0.9)
+animation(blink 1s 0s reverse infinite)
+transform(translateZ(0))
.table
display: table
height: 5em
width: 100%
vertical-align: middle
.cell
display: table-cell
width: 100%
height: 100%
vertical-align: middle
http://codepen.io/anon/pen/kaGxC (sass with bourbon)
Another variation
.blink {
-webkit-animation: blink 1s step-end infinite;
animation: blink 1s step-end infinite;
}
#-webkit-keyframes blink { 50% { visibility: hidden; }}
#keyframes blink { 50% { visibility: hidden; }}
This is <span class="blink">blink</span>
If you want smooth blinking text or something a like you can use following code:
.blinking {
-webkit-animation: 1s blink ease infinite;
-moz-animation: 1s blink ease infinite;
-ms-animation: 1s blink ease infinite;
-o-animation: 1s blink ease infinite;
animation: 1s blink ease infinite;
}
#keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
#-moz-keyframes blink {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
#-webkit-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
#-ms-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
#-o-keyframes "blink" {
from,
to {
opacity: 0;
}
50% {
opacity: 1;
}
}
<span class="blinking">I am smoothly blinking</span>
It's working in my case blinking text at 1s interval.
.blink_me {
color:#e91e63;
font-size:140%;
font-weight:bold;
padding:0 20px 0 0;
animation: blinker 1s linear infinite;
}
#keyframes blinker {
50% { opacity: 0.4; }
}
if you want some glow effect use this
#keyframes blink {
50% {
opacity: 0.0;
}
}
#-webkit-keyframes blink {
50% {
opacity: 0.0;
}
}
atom-text-editor::shadow .bracket-matcher .region {
border:none;
background-color: rgba(195,195,255,0.1);
border-bottom: 1px solid rgb(155,155,255);
box-shadow: 0px 0px 9px 4px rgba(155,155,255,0.1);
border-radius: 3px;
animation: blink 2s steps(115, start) infinite;
-webkit-animation: blink 2s steps(115, start) infinite;
}
Please find below solution for your code.
#keyframes blink {
50% {
color: transparent;
}
}
.loader__dot {
animation: 1s blink infinite;
}
.loader__dot:nth-child(2) {
animation-delay: 250ms;
}
.loader__dot:nth-child(3) {
animation-delay: 500ms;
}
Loading <span class="loader__dot">.</span><span class="loader__dot">.</span><span class="loader__dot">.</span>