html - Spinning circles css3 transition -
i want make 3 spinning circles can`t find examples.
how need work: there 3 circles (big,medium,small) want rotate them on hover (small , medium change position on big circuit)
img:
https://dl.dropboxusercontent.com/u/64675374/circle/circle1.png
single img:
https://dl.dropboxusercontent.com/u/64675374/circle/small.png https://dl.dropboxusercontent.com/u/64675374/circle/medium.png https://dl.dropboxusercontent.com/u/64675374/circle/big.png
here code 1 circle. how make big circle background of , add medium circle
http://jsfiddle.net/aqkyc/293/
css:
.dot{ position:absolute; top:0; left:0; width:300px; height:100%; background: url('https://dl.dropboxusercontent.com/u/64675374/circle/small.png') no-repeat 50% 50%; } .sun{ width:200px; height:200px; position:absolute; -webkit-animation-iteration-count:infinite; -webkit-animation-timing-function:linear; -webkit-animation-name:orbit; -webkit-animation-duration:5s; -moz-animation-iteration-count:infinite; -moz-animation-timing-function:linear; -moz-animation-name:orbit; -moz-animation-duration:5s; top:50px; left:50px; } @-webkit-keyframes orbit { { -webkit-transform:rotate(0deg) } { -webkit-transform:rotate(360deg) } } @-moz-keyframes orbit { { -moz-transform:rotate(0deg) } { -moz-transform:rotate(360deg) } }
html
<div class="sun"> <div class="dot"></div> </div>
here approach problem:
first placed elements this:
the trick add css attribute translatex(260px)
(half of biggest image circle/big.png
), , need animate rotation!
from { -transform: rotate(0deg) translatex(260px) } { -transform: rotate(360deg) translatex(260px) }
fullcode:
html:
<div class="loading"> <div class="circle-small"></div> <div class="circle-medium"></div> <div class="circle-big"></div> </div>
css: (shortned - webkit only, full code @ jsfiddle)
.loading { width: 688px; height: 688px; position: relative; } .loading > div { position: absolute; } .circle-small { background-image: url('https://dl.dropboxusercontent.com/u/64675374/circle/small.png'); width: 162px; height: 161px; margin-left: 348px; margin-top: 348px; -webkit-animation: myorbit1 3s linear infinite; } .circle-medium { background-image: url('https://dl.dropboxusercontent.com/u/64675374/circle/medium.png'); width: 338px; height: 339px; margin-left: 260px; margin-top: 260px; -webkit-animation: myorbit2 4s linear infinite; } .circle-big { background-image: url('https://dl.dropboxusercontent.com/u/64675374/circle/big.png'); width: 518px; height: 517px; margin-left: 170px; margin-top: 170px; } @-webkit-keyframes myorbit1 { { -webkit-transform: rotate(0deg) translatex(260px) rotate(0deg); } { -webkit-transform: rotate(360deg) translatex(260px) rotate(-360deg); } } @-webkit-keyframes myorbit2 { { -webkit-transform: rotate(360deg) translatex(260px) rotate(0deg); } { -webkit-transform: rotate(0deg) translatex(260px) rotate(-360deg); } }
Comments
Post a Comment