Jquery
I want to rotate a wheel of random numbers using jquery animate function,not understanding how to do it.Please do let me know about the solution
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Karthikeyan KPosted Sep 4, 2015, 2:15 AM
Aniket NarvankarPosted Sep 4, 2015, 12:56 AM
Karthikeyan KPosted Sep 3, 2015, 8:03 AM
Cheers!!
Aniket NarvankarPosted Sep 3, 2015, 7:56 AM
Karthikeyan KPosted Sep 3, 2015, 5:55 AM
Karthikeyan KPosted Sep 3, 2015, 5:51 AM
from { transform:rotate(0deg); }
to { transform:rotate(360deg); }
}
body {
background-color: Aquamarine;
}
@keyframes inner-circle {
from { transform:rotate(0deg); }
to { transform:rotate(-360deg); }
}
#rot {
width:350px;
height:350px;
margin:20px auto;
font-size:16px;
line-height:1;
animation: circle 25s linear infinite;
transform-origin: 50% 50%;
}
#rot > div {
animation: inner-circle 25s linear infinite;
width:50px;
height:50px;
}
var block = $("#rot div").get(),
increase = Math.PI * 2 / block.length,
x = 0, y = 0, angle = 0;
for (var i = 0; i < block.length; i++) {
var elem = block[i];
x = 140 * Math.cos(angle) + 150;
y = 140 * Math.sin(angle) + 150;
elem.style.position = 'absolute';
elem.style.left = x + 'px';
elem.style.top = y + 'px';
var rot = 90 + (i * (360 / block.length));
angle += increase;
}
});
PradeepPosted Sep 3, 2015, 5:49 AM