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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
PradeepRank #6,279 · 271 reputationPosted Sep 3, 2015, 1:49 AM EDT
Try this. $(function() { var $elie = $("img"), degree = 0, timer; rotate(); function rotate() { $elie.css({ WebkitTransform: 'rotate(' + degree + 'deg)'}); $elie.css({ '-moz-transform': 'rotate(' + degree + 'deg)'}); timer = setTimeout(function(){ ++degree; rotate(); },5); } $("input").toggle(function() { clearTimeout(timer); }, function() { rotate(); }); });Karthikeyan KRank #554 · 4.4K reputationPosted Sep 3, 2015, 1:51 AM EDT
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;
}
});
Karthikeyan KRank #554 · 4.4K reputationPosted Sep 3, 2015, 1:55 AM EDT
Aniket NarvankarRank #903 · 2.3K reputationPosted Sep 3, 2015, 3:56 AM EDT
Karthikeyan KRank #554 · 4.4K reputationPosted Sep 3, 2015, 4:03 AM EDT
Cheers!!
Aniket NarvankarRank #903 · 2.3K reputationPosted Sep 3, 2015, 8:56 PM EDT
Karthikeyan KRank #554 · 4.4K reputationPosted Sep 3, 2015, 10:15 PM EDT