Today, I've tried a dice dojo animation ... but it does not start, is someone able to tell me what 's wrong inside?
it turns the dice while changing the face of the dice (with backgroundposition).
in setup:
Code: Select all
dojo.forEach( ['transform', 'WebkitTransform', 'msTransform','MozTransform', 'OTransform'],
function (name) {
if (typeof dojo.body().style[name] != 'undefined') {
this.transform = name;
}
}
);
Code: Select all
rollDice:function(node,dice)
{
var animation = new dojo.Animation({
curve: [0, 720],
onEnd: function(){
$val= dice*70;
node.style.backgroundPosition ='-'+$val+'px -70px';
},
onAnimate: function (v) {
node.style[this.transform] = 'rotate(' + v + 'deg)';
if (!(v%60)){
d=70*Math.floor((Math.random() * 6) + 1);
node.style.backgroundPosition ='-'+d+'px -70px';
}
}
}).play();
},