html - CSS3 Animation not working -
i trying 1 div rotate around using css3 reason not animate @ all. using chrome. can help?
here css
.container { margin: 0 auto; position: relative; } #center { width: 300px; height: 300px; margin: 225px auto 0; border: 5px solid #ddd; border-radius: 100%; background: #aaa; } @-webkit-keyframes rot { { transform: rotate(0deg) translate(-150px) rotate(0deg); } { transform: rotate(360deg) translate(-150px) rotate(-360deg); } } @keyframes rot { { transform: rotate(0deg) translate(-150px) rotate(0deg); } { transform: rotate(360deg) translate(-150px) rotate(-360deg); } } #small { position: absolute; width: 75px; height: 75px; border: 5px solid #ddd; border-radius: 100%; background: #aaa; animation: rot 3s infinite linear; -webkit-animation: rot 3s linear infinite; } and here html
<div class="container"> <div id="center"></div> <div id="small"></div> </div>
you need use -webkit prefix proprietary property ensure animation runs in webkit browsers
you need use prefix webkit browsers
.container { margin: 0 auto; position: relative; } #center { width: 300px; height: 300px; margin: 225px auto 0; border: 5px solid #ddd; border-radius: 100%; background: #aaa; } @keyframes rot { { transform: rotate(0deg) translate(-150px) rotate(0deg); -webkit-transform: rotate(0deg) translate(-150px) rotate(0deg); } { transform: rotate(360deg) translate(-150px) rotate(-360deg); -webkit-transform: rotate(360deg) translate(-150px) rotate(-360deg); } } @-webkit-keyframes rot { { transform: rotate(0deg) translate(-150px) rotate(0deg); -webkit-transform: rotate(0deg) translate(-150px) rotate(0deg); } { transform: rotate(360deg) translate(-150px) rotate(-360deg); -webkit-transform: rotate(360deg) translate(-150px) rotate(-360deg); } } #small { position: absolute; width: 75px; height: 75px; border: 5px solid #ddd; border-radius: 100%; background: #aaa; animation: rot 3s infinite linear; -webkit-animation: rot 3s linear infinite; transform-origin: 50% 200px; -webkit-transform-origin: 50% 200px; } side note: should use proprietary properties of each browser i.e
-moz,-webkit,-o,-msolder versions of browser don't fail animate
Comments
Post a Comment