Animation not working in mozilla - html
this codepen works in google chrome but it is not working in mozilla firefox.
CodePen Demo
<svg version="1.1" id="svg_snowman" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" width="286px" height="380px" viewBox="0 0 286 380" enable-background="new 0 0 286 380" xml:space="preserve">
<g id="snowman">
<path class="snowman_body" d="M20.302,221.826c-6.899,83.792,106.271,110.246,149.672,47.643
C236.041,174.189,29.782,107.401,20.302,221.826z"/>
<path class="scarf" d="M62.978,157.992c-5.486,2.424-8.756,6.673-7.191,13.735
c1.887,8.643,12.927,16.689,20.227,20.237c18.053,8.676,44.348,8.364,61.527-3.758c29.854-21.115-24.191-30.144-37.011-31.832
C92.905,155.356,73.691,153.215,62.978,157.992z"/>
<path class="scarf_knot" d="M88.509,177.525c-18.559,6.252-29.452,33.552-28.112,51.221
c0.11,0.106,0.256,0.247,0.365,0.353c8.537-1.302,15,3.198,22.443,6.22c-0.542-15.985,0.146-31.726,13.332-43.214
c0.143-0.106,0.143-0.106,0,0c-4.759,8.534-6.463,21.221-6.463,30.845c6.247-2.494,13.292-3.97,19.828-1.826
c-1.124-12.893-1.924-27.72,8.281-37.698c-4.831-2.986-10.494-5.587-16.126-6.641L88.509,177.525z"/>
<path class="snowman_head" d="M145.783,120.573c-2.77-5.274-6.473-9.863-11.039-13.207
c-2.725-2.003-5.629-3.761-8.606-5.304C72.5,78.667,53.571,129.255,53.534,129.323c-2.471,8.272-2.59,17.065,0.24,25.173
c1.245,3.568,3.056,7.005,5.499,10.204c16.309,21.327,54.842,28.984,77.794,12.79C153.694,165.722,155.441,138.96,145.783,120.573z
"/>
<g id="hat">
<path class="hat-ribbon" d="M45.071,104.135l6.829,12.61c34.1-33.933,65.013-19.442,65.013-19.442l-1.961-14.935
C90.037,83.282,65.447,89.325,45.071,104.135z"/>
<path class="hat-top" d="M112.882,63.362c0,0-8.829-9.698-36.575-5.148C37.661,64.555,35.338,85.67,35.338,85.67l9.733,18.465
c20.376-14.81,44.966-20.853,69.881-21.766L112.882,63.362z"/>
<path class="hat-bottom" d="M53.534,129.075c0.036-0.068,25.632-34.575,72.603-27.137c2.978,1.543,5.882,3.363,8.606,5.366
c4.566,3.344,8.269,7.964,11.039,13.238c9.431-9.731,8.321-22.45-4.971-27.139c-20.632-7.306-44.275-2.84-64.322,4.855
c-16.056,6.149-33.525,18.058-36.938,35.628C37.229,145.866,42.802,151,53.768,154h0.006
C50.945,146,51.063,137.347,53.534,129.075z"/>
</g>
<path class="nose" d="M104.781,143.55c-1.708,18.2,27.856,10.402,38.028,9.453c7.191-0.669,13.764-1.581,20.483-2.495
c6.539-0.845,6.792-2.953,0.545-5.095c-7.264-2.53-14.02-5.127-22.008-8.219c-7.048-2.707-21.612-6.956-29.092-5.059
C108.523,133.19,105.436,136.455,104.781,143.55z"/>
<path class="mouth-1" d="M84.079,158.94c-0.91,0.492-2.034,0.106-2.506-0.842c-0.439-0.913,0.036-1.932,0.98-2.321
c0.944-0.421,2.034,0,2.433,0.878C85.422,157.465,84.986,158.519,84.079,158.94z"/>
<path class="mouth-2" d="M88.292,164.63c-0.691,0.739-2.034,0.881-2.651-0.036c-0.688-0.878-0.582-2.07,0.292-2.633
c0.834-0.527,1.961-0.457,2.502,0.212C88.874,162.945,88.984,163.893,88.292,164.63z"/>
<path class="mouth-3" d="M94.43,168.426c-0.472,0.88-1.635,1.263-2.579,0.81c-1.017-0.353-1.236-1.652-0.654-2.462
c0.581-0.842,1.562-0.984,2.469-0.701C94.54,166.458,94.865,167.513,94.43,168.426z"/>
<path class="mouth-4" d="M101.222,170.849c-0.256,0.948-1.309,1.511-2.326,1.266c-1.017-0.283-1.559-1.231-1.163-2.215
c0.329-0.913,1.382-1.475,2.289-1.231C100.967,168.882,101.478,169.866,101.222,170.849z"/>
<path class="mouth-5" d="M108.376,172.151c-0.109,0.984-1.053,1.72-2.107,1.578c-1.053-0.106-1.741-0.983-1.525-2.002
c0.18-0.913,1.126-1.649,2.07-1.543C107.795,170.254,108.486,171.167,108.376,172.151z"/>
<path class="mouth-6" d="M115.64,172.36c0.036,1.019-0.761,1.864-1.814,1.935c-1.053,0.103-1.891-0.739-1.817-1.793
c0.036-0.948,0.837-1.758,1.817-1.829C114.77,170.602,115.568,171.376,115.64,172.36z"/>
<path class="mouth-7" d="M122.831,171.412c0.256,0.948-0.399,1.967-1.452,2.212c-1.017,0.318-1.964-0.418-2.107-1.437
c-0.109-0.983,0.545-1.829,1.452-2.109C121.632,169.83,122.576,170.463,122.831,171.412z"/>
<path class="mouth-8" d="M129.587,168.953c0.508,0.878,0.146,2.002-0.837,2.494c-0.907,0.598-2.034,0.035-2.393-0.913
c-0.329-0.948,0.107-1.864,0.871-2.388C128.025,167.722,129.115,168.075,129.587,168.953z"/>
<path class="mouth-9" d="M135.252,164.665c0.798,0.669,0.834,1.864,0.073,2.671c-0.761,0.81-1.888,0.775-2.542-0.103
c-0.545-0.739-0.545-1.932,0-2.568C133.402,163.999,134.491,164.035,135.252,164.665z"/>
<path class="mouth-10" d="M138.994,158.763c0.944,0.318,1.416,1.408,1.017,2.426c-0.399,1.019-1.452,1.369-2.323,0.842
c-0.874-0.527-1.346-1.617-1.053-2.426C136.961,158.763,138.014,158.413,138.994,158.763z"/>
<path class="eye_left" d="M94.939,125.986c4.396-2.494,0.581-8.746-3.775-6.535
C86.585,121.769,90.037,128.76,94.939,125.986z"/>
<path class="eye_right" d="M127.663,123.63c4.393-2.456,0.582-8.746-3.778-6.497
C119.309,119.451,122.758,126.407,127.663,123.63z"/>
<path class="button_top" d="M134.053,227.38c13.039-2.391,12.205-20.626-2.323-18.904
C116.767,210.306,119.891,229.978,134.053,227.38z"/>
<path class="button_bottom" d="M130.022,262.687c11.696,1.157,17.289-16.336,5.267-19.219
C123.522,240.659,115.205,261.176,130.022,262.687z"/>
</g>
</svg>
Can someone point me as to why is it not working in mozilla?
You are missing the standard syntax without prefixes, that's why doesn't work on non--webkit- browsers that don't require prefixes.
Browser support for animation and transform
Updated CodePen
.snowman_body {
fill: #F5ECC3;
-webkit-animation: body-drop 0.5s ease-in forwards;
animation: body-drop 0.5s ease-in forwards;
}
.scarf {
fill: #EF3C3C;
opacity: 0;
-webkit-animation: scale 0.5s ease 1s forwards;
animation: scale 0.5s ease 1s forwards;
-webkit-transform-origin: 55px 165px;
animation: scale 0.5s ease 1s forwards;
}
.scarf_knot {
fill: #EF3C3C;
opacity: 0;
-webkit-animation: scale 0.3s ease 1.5s forwards;
animation: scale 0.3s ease 1.5s forwards;
-webkit-transform-origin: 92px 190px;
transform-origin: 92px 190px;
}
.snowman_head {
fill: #F5ECC3;
-webkit-transform: translateY(-303px);
transform: translateY(-303px);
-webkit-animation: body-drop 0.5s ease-in 0.2s forwards;
animation: body-drop 0.5s ease-in 0.2s forwards;
}
#hat {
-webkit-transform: translateY(-303px);
transform: translateY(-303px);
-webkit-animation: body-drop 0.5s ease-in 0.3s forwards;
animation: body-drop 0.5s ease-in 0.3s forwards;
}
.hat-top {
fill: #5B4831;
}
.hat-ribbon {
fill: #EF3C3C;
}
.hat-bottom {
fill: #5B4831;
}
.nose {
fill: #EF3C3C;
opacity: 0;
-webkit-animation: scale 0.3s ease 2.5s forwards;
animation: scale 0.3s ease 2.5s forwards;
-webkit-transform-origin: 104px 142px;
transform-origin: 104px 142px;
}
.mouth-1 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.1s forwards;
animation: scale 0.1s ease 3.1s forwards;
-webkit-transform-origin: 82px 156px;
transform-origin: 82px 156px;
}
.mouth-2 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.2s forwards;
animation: scale 0.1s ease 3.2s forwards;
-webkit-transform-origin: 86px 162px;
transform-origin: 86px 162px;
}
.mouth-3 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.3s forwards;
animation: scale 0.1s ease 3.3s forwards;
-webkit-transform-origin: 92px 167px;
transform-origin: 92px 167px;
}
.mouth-4 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.4s forwards;
animation: scale 0.1s ease 3.4s forwards;
-webkit-transform-origin: 98px 169px;
transform-origin: 98px 169px;
}
.mouth-5 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.5s forwards;
animation: scale 0.1s ease 3.5s forwards;
-webkit-transform-origin: 106px 171px;
transform-origin: 106px 171px;
}
.mouth-6 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.6s forwards;
nimation: scale 0.1s ease 3.6s forwards;
-webkit-transform-origin: 113px 171px;
transform-origin: 113px 171px;
}
.mouth-7 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.7s forwards;
animation: scale 0.1s ease 3.7s forwards;
-webkit-transform-origin: 120px 171px;
transform-origin: 120px 171px;
}
.mouth-8 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.8s forwards;
animation: scale 0.1s ease 3.8s forwards;
-webkit-transform-origin: 127px 169px;
transform-origin: 127px 169px;
}
.mouth-9 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 3.9s forwards;
animation: scale 0.1s ease 3.9s forwards;
-webkit-transform-origin: 132px 165px;
transform-origin: 132px 165px;
}
.mouth-10 {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.1s ease 4.0s forwards;
animation: scale 0.1s ease 4.0s forwards;
-webkit-transform-origin: 137px 160px;
transform-origin: 137px 160px;
}
.eye_left {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.2s ease 2.7s forwards;
animation: scale 0.2s ease 2.7s forwards;
-webkit-transform-origin: 92px 122px;
transform-origin: 92px 122px;
}
.eye_right {
fill: #5B4831;
opacity: 0;
-webkit-animation: scale 0.2s ease 2.9s forwards;
animation: scale 0.2s ease 2.9s forwards;
-webkit-transform-origin: 125px 120px;
transform-origin: 125px 120px;
}
.button_top {
fill: #09B0A6;
opacity: 0;
-webkit-animation: scale 0.3s ease 2.2s forwards;
animation: scale 0.3s ease 2.2s forwards;
-webkit-transform-origin: 132px 217px;
transform-origin: 132px 217px;
}
.button_bottom {
fill: #09B0A6;
opacity: 0;
-webkit-animation: scale 0.3s ease 2s forwards;
animation: scale 0.3s ease 2s forwards;
-webkit-transform-origin: 132px 252px;
transform-origin: 132px 252px;
}
#-webkit-keyframes body-drop {
0% {
transform: translateY(-303px);
}
100% {
transform: translateY(0px);
}
}
#keyframes body-drop {
0% {
transform: translateY(-303px);
}
100% {
transform: translateY(0px);
}
}
#-webkit-keyframes scale {
0% {
opacity: 1;
transform: scale(0, 0);
}
100% {
opacity: 1;
transform: scale(1, 1);
}
}
#keyframes scale {
0% {
opacity: 1;
transform: scale(0, 0);
}
100% {
opacity: 1;
transform: scale(1, 1);
}
}
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); } }
CSS transitions shaking in chrome and IE
I am new to developing, can anyone please help me with this.. css transitions are shaking in chrome and IE, I have tried all possible styling to correct it, but could'nt. please help!. here is the fiddle https://jsfiddle.net/Khan_Z/qoL4xqhq/ <header> <h2 id="head1"><span>Sometimes </span><span>you win </span> <span>sometimes</span> <span>you learn</span></h2> <div> <h2 id="head2" class="subtitle fancy"><span>Hi</span></h2> <h2 id="head3" >ABCD</h2> <p id="head4">UVWXYZ:)</p> </div> #head1{ width:100%; margin-top:375px ; font-size:40px; text-align:center; position:absolute; } #head2{ position:absolute; font-size:42px; margin-top:450px; text-align:center; margin-left:47%; } #head3{ position:absolute; margin-top:460px; margin-left:43%; font-size:40px; line-height:2; text-align:center; } #head4{ position:absolute; margin-top:510px; margin-left:40%; font-size:35px; text-align:center; } #head1{ -webkit-animation: none; -moz-animation: none; -ms-animation:none; animation: none; color: #fff; text-shadow: 0px 0px 1px #CCCCCC; } #head1 span { -webkit-animation: blurFadeIn 1s ease-in 0s backwards; -moz-animation: blurFadeIn 1s ease-in 0s backwards; -ms-animation: blurFadeIn 1s ease-in 0s backwards; animation: blurFadeIn 1s ease-in 0s backwards; color: black; text-shadow: 0px 0px 1px #CCCCCC; } #head1 span:nth-child(2) { -webkit-animation-delay: 1s; -moz-animation-delay: 1s; animation-delay: 1s; } #head1 span:nth-child(3) { -webkit-animation-delay: 2s; -moz-animation-delay: 2s; animation-delay: 2s; } #head1 span:nth-child(4) { -webkit-animation-delay: 3s; -moz-animation-delay: 3s; animation-delay: 3s; } #head2 { -webkit-animation: blurFadeIn 1s ease-in 0s backwards; -moz-animation: blurFadeIn 1s ease-in 0s backwards; -ms-animation: blurFadeIn 1s ease-in 0s backwards; animation: blurFadeIn 1s ease-in 0s backwards; color:black; text-shadow: 0px 0px 1px #CCCCCC; } #head2 { -webkit-animation-delay: 5s; -moz-animation-delay: 5s; -ms-animation-delay:5s; animation-delay: 5s; } #head3 { -webkit-animation: blurFadeIn 1s ease-in 0s backwards; -moz-animation: blurFadeIn 1s ease-in 0s backwards; -ms-animation: blurFadeIn 1s ease-in 0s backwards; animation: blurFadeIn 1s ease-in 0s backwards; color: black; text-shadow: 0px 0px 1px #CCCCCC; } #head3 { -webkit-animation-delay: 5s; -moz-animation-delay: 5s; -ms-animation-delay:5s; animation-delay: 5s; } #head4{ -webkit-animation: blurFadeIn 1s ease-in 0s backwards; -moz-animation: blurFadeIn 1s ease-in 0s backwards; -ms-animation: blurFadeIn 1s ease-in 0s backwards; animation: blurFadeIn 1s ease-in 0s backwards; color: black; text-shadow: 0px 0px 1px #CCCCCC; } #head4 { -webkit-animation-delay: 6s; -moz-animation-delay: 6s; -ms-animation-delay:6s; animation-delay: 6s; } #-webkit-keyframes blurFadeInOut{ 0%{ opacity: 0; text-shadow: 0px 0px 40px #fff; -webkit-backface-visibility:hidden; -webkit-transform: scale(1.3); transform: scale(1.3); } 20%,75%{ opacity: 1; text-shadow: 0px 0px 1px #fff; -webkit-backface-visibility:hidden; -webkit-transform: scale(1); transform: scale(1); } 100%{ opacity: 0; text-shadow: 0px 0px 50px #fff; -webkit-backface-visibility:hidden; -webkit-transform: scale(0); transform: scale(0); } } #-webkit-keyframes blurFadeIn{ 0%{ opacity: 0; text-shadow: 0px 0px 40px #fff; -webkit-backface-visibility:hidden; -webkit-transform:scale(1.3); transform: scale(1.3); } 50%{ opacity: 0.5; text-shadow: 0px 0px 10px #fff; -webkit-backface-visibility:hidden; -webkit-transform: scale(1.1); transform: scale(1.1); } 100%{ opacity: 1; text-shadow: 0px 0px 1px #fff; -webkit-backface-visibility:hidden; -webkit-transform: scale(1); transform: scale(1); } } #-webkit-keyframes fadeInBack{ 0%{ opacity: 0; -webkit-backface-visibility:hidden; -webkit-transform: scale(0); transform: scale(0); } 50%{ opacity: 0.4; -webkit-transform: scale(2); -webkit-backface-visibility:hidden; -webkit-transform:scale(2); transform: scale(2); } 100%{ opacity: 0.2; -webkit-backface-visibility:hidden; -webkit-transform:scale(5); transform: scale(5); } } #-webkit-keyframes fadeInRotate{ 0%{ opacity: 0; -webkit-transform: scale(0) rotate(360deg); transform: scale(0); -webkit-backface-visibility:hidden; -webkit-transform: scale(0) ; } 100%{ opacity: 1; -webkit-transform: scale(1) rotate(-0deg); transform: scale(1); -webkit-backface-visibility:hidden; -webkit-transform: scale(1); } }
instead of margin-top use top and use % instead of px on top it will be fine
Start css3 animation when the content is visible
I've made an animation using svg and now I wonder how to activate it when it shows on the screen. Tried with Scroll Reveal but it doesn't work. Here is the animation: http://jsfiddle.net/z86026mv/148/light/ HTML <svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" width="136.5px" height="100.15px" viewBox="0 0 136.5 100.15" enable-background="new 0 0 136.5 100.15" xml:space="preserve"> <rect class="key" x="111.284" y="80.95" fill="none" stroke="#000000" stroke-width="6" stroke-miterlimit="10" width="1.02" height="1.02"/> <path class="phone" fill="none" stroke="#000000" stroke-width="6" stroke-miterlimit="10" d="M102.85 31.275L90.902 43.222v51.003h29.837l11.947-11.946V31.275H102.85z"/> <polyline class="bottom_line" fill="none" stroke="#000000" stroke-width="6" stroke-miterlimit="10" points="52.476 94.225 65.188 94.225 78.059 94.225 "/> <line class="vert_line" fill="none" stroke="#000000" stroke-width="6" stroke-miterlimit="10" x1="65.188" y1="94.225" x2="65.188" y2="81.969"/> <polyline class="screen" fill="none" stroke="#000000" stroke-width="6" stroke-miterlimit="10" points="120.74 22.27 120.74 5.924 3.813 5.924 3.813 81.969 82.262 81.969 "/> CSS /*Animacje*/ svg * { fill: none; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; color: #100F0D; stroke-width: 6; stroke-miterlimit: 10; } .phone { animation: draw 1.5s cubic-bezier(1, 0.1, 0, 0.87) alternate; -webkit-animation: draw 1.5s cubic-bezier(1, 0.1, 0, 0.87) alternate; } #keyframes draw { 0% { stroke-dashoffset: 192; stroke-dasharray: 192; } 100% { stroke-dashoffset: 0; stroke-dasharray: 192; } } .screen { animation: screen 1.5s cubic-bezier(1, 0.1, 0, 0.87) alternate; -webkit-animation: screen 1.5s cubic-bezier(1, 0.1, 0, 0.87) alternate; fill-opacity: 0; stroke: #000; stroke-width: 6; } #keyframes screen { 0% { stroke-dashoffset: 290; stroke-dasharray: 290; } 100% { stroke-dashoffset: 0; stroke-dasharray: 290; } } .bottom_line { position: absolute; opacity: 0; -webkit-animation: bottom_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; -moz-animation: bottom_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; -o-animation: bottom_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; animation: bottom_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; } #keyframes bottom_line { 0% { opacity: 1; stroke-dashoffset: 290; stroke-dasharray: 290; } 100% { opacity: 1; stroke-dashoffset: 0; stroke-dasharray: 290; } } .vert_line{ position: absolute; opacity: 0; -webkit-animation: vert_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; -moz-animation: vert_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; -o-animation: vert_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; animation: vert_line 1s cubic-bezier(1, 0.1, 0, 0.87) 1s forwards; } #keyframes vert_line { 0% { opacity: 1; stroke-dashoffset: 290; stroke-dasharray: 290; } 100% { opacity: 1; stroke-dashoffset: 0; stroke-dasharray: 290; } } .key { position: absolute; opacity: 0; -webkit-animation: key 1s ease 1s forwards; -moz-animation: key 1s ease 1s forwards; -o-animation: key 1s ease 1s forwards; animation: key 1s ease 1s forwards; } #keyframes key { 0% { opacity: 0; transform: translate(-35px,0px); -ms-transform: translate(-35px,0px); /* IE 9 */ -webkit-transform: translate(-35px,0px); /* Safari and Chrome */ -o-transform: translate(-35px,0px); /* Opera */ -moz-transform: translate(-35px,0px); /* Firefox */ } 100% { opacity: 1; transform: translate(0,0px); -ms-transform: translate(0,0px); /* IE 9 */ -webkit-transform: translate(0,0px); /* Safari and Chrome */ -o-transform: translate(0,0px); /* Opera */ -moz-transform: translate(0,0px); /* Firefox */ } } #-webkit-keyframes key { 0% { opacity: 0; } 100% { opacity: 1; } } And here, in the "Service" section I have placed it. http://flowagency.nu/index_ico.php Do you have any ideas? Thx in advance.
you can set the display of the svg to none var svg = document.getElementsByTagName("svg")[0]; svg.style.display='none'; then when you click on the service tab you can set the display to block svg.style.display='block'; watch out the example below i did the second step using setTimeout you can do it with click or whatever you like http://jsfiddle.net/z86026mv/149/
CSS animation working differently in Chrome
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>
webkit-animation is not working
<style> .abc .abc-animation { position: relative; margin: 0 auto; width: 632px; height: 460px; overflow: hidden; background-position: 50% 50%; background-repeat: no-repeat; background-color: transparent; background-image: url("http://zacharybrown.files.wordpress.com/2008/05/7-indians-chief.jpg"); } .abc .ready .mouse { -webkit-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -moz-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -ms-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -o-animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; animation: mouseani 8s 0s 1 normal forwards, mousegone .1s 8s 1 normal forwards; -webkit-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -moz-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -o-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); -ms-animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); animation-timing-function: cubic-bezier(0.5, 0.05, 0 0.6, 1); } .abc .mouse { position: absolute; left: -9px; top: -9px; z-index: 10; display: inline-block; opacity: 0; width: 16px; height: 16px; background-color: #808080; border-radius: 18px; border: 2px solid #fff; -webkit-transform: translate(150px, 105px); -moz-transform: translate(150px, 105px); -o-transform: translate(150px, 105px); -ms-transform: translate(150px, 105px); transform: translate(150px, 105px); } .abc .ready .mouse .click { -webkit-animation: mouseclick 8s 0s 1 normal forwards; -moz-animation: mouseclick 8s 0s 1 normal forwards; -o-animation: mouseclick 8s 0s 1 normal forwards; -ms-animation: mouseclick 8s 0s 1 normal forwards; animation: mouseclick 8s 0s 1 normal forwards; } .abc .mouse .click { display: inline-block; opacity: 0; width: 6px; height: 6px; background-color: #fff; border-radius: 3px; position: absolute; left: 5px; top: 5px; } .abc .ready .screen { opacity: 0; } .abc .screen.one { z-index: 5; background-image: url("http://3.bp.blogspot.com/-2kEUWmGpQlw/T4m3TJnnxdI/AAAAAAAABWs/LrY8LwQwWMg/s1600/DA0087.jpg"); -webkit-transition-delay: 2s; -moz-transition-delay: 2s; -o-transition-delay: 2s; -ms-transition-delay: 2s; transition-delay: 2s; } .abc .screen { width: 632px; height: 460px; background-position: 50% 50%; background-repeat: no-repeat; background-color: transparent; position: absolute; top: 0; left: 0; opacity: 1; -webkit-transition: all 0.1s ease-in-out; -moz-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out; -ms-transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out; } .abc .screen.two { z-index: 4; background-image: url("http://cloud3.faout.com/uploads/201208/heditor/201208171536178403.jpg"); -webkit-transition-delay: 5s; -moz-transition-delay: 5s; -o-transition-delay: 5s; -ms-transition-delay: 5s; transition-delay: 5s; } .abc .screen.three { z-index: 3; background-image: url("http://blog.seattletimes.nwsource.com/seattlesketcher/linesmith-m.jpg"); -webkit-transition-delay: 8s; -moz-transition-delay: 8s; -o-transition-delay: 8s; -ms-transition-delay: 8s; transition-delay: 8s; } </style> <article class="abc"> <div class="container clear"> <div class="abc-block browser"> <div class="browser-bar"> <div class="browser-button"></div> <div class="browser-button"></div> <div class="browser-button"></div> </div> <div class="browser-content"> <div class="abc-animation ready"> <div class="mouse"><span class="click"></span></div> <div class="screen one"></div> <div class="screen two"></div> <div class="screen three"></div> <div class="screen four"></div> </div> </div> </div> </div> </article> In above code i want to animate one circle dot which moves at three different place but it not working. so what's wrong in above code? i know such a big code but i hope will get some good response and will be able to solve my problem.
You are missing keyframes, an at-rule that defines what your animation frames will be: #keyframes mouseani { 0% { /* initial state */ } /* * intermediate states */ 100% { /* final state */ } }