My spinning game: view-source:http://driptone.com/jony/applications/luckyspin/
Previous question (Explains about the animation): CSS spinning wheel stop after 5 seconds?
Please click on "Spin", it will spin the wheel.
I want to make so at some point, the wheel will start slowly stopping, by slowly adding more MS to the animation until it becomes really really slow.
is it possible to make, without re-setting the image ? By re-setting I mean, if the wheel is currently spinning at 440 Degrees, Make it spin slower, without resetting it to 0 degrees.
Is that possible?
I will be able to use Javascript aswell, considering I want it to slowly stop right after the generated number appears (AJAX response arrives)
Original JAVASCRIPT code:
function spinWheel() {
$(".wheel").html("<div class='wheel_spin_on'></div>");
}
function stopWheel() {
$(".wheel").html("<div class='wheel_spin' onClick='loadLuck();'></div>");
}
var timeoutID = '';
function loadLuck() {
clearTimeout(timeoutID);
spinWheel();
$("#luck").html('Spinning......');
timeoutID = setTimeout(function() {
$.post('ajax.php', {getLuck : '1'}, function(data) {
$("#luck").html(data);
stopWheel();
});
}, 3000);
}
CSS code:
.wheel_spin {
background-image: url("../img/spin2.png");
background-repeat: no-repeat;
width: 262px;
height: 261px;
margin-left: 1%;
}
.wheel_spin_finished {
background-image: url("../img/spin.png");
background-repeat: no-repeat;
width: 262px;
height: 261px;
margin-left: 1%;
}
.wheel_spin_on {
background-image: url("../img/spin.png");
background-repeat: no-repeat;
width: 262px;
height: 261px;
margin-left: 1%;
-webkit-animation-name: spin;
-webkit-animation-duration: 500ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 500ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 500ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
animation-name: spin;
animation-duration: 500ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@-ms-keyframes spin {
from { -ms-transform: rotate(0deg); }
to { -ms-transform: rotate(360deg); }
}
@-moz-keyframes spin {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}