I'm trying to randomize some settings in a tween. The first time it gets random values, but each iteration thereafter is identical.
function RandomTween(e,o,w,h){
TweenMax.to(e, 0, {x:(int(o.left*w)), y:(int(o.top*h)),rotation:getRandomArbitary(1.05,6.25)+"rad"});
TweenMax.to(e, getRandomArbitary(0.5,5), {y: o.animation.to.y*h,repeat:-1,x: o.animation.to.x*w,force3D:true,
rotation:getRandomArbitary(1.05,6.25)+"rad",ease:Linear.easeNone,onComplete:function(e,o,w,h){
RandomTween(e,o,w,h);
},onCompleteParams:[e,o,w,h]});
}
/**
* Returns a random number between min and max
*/
function getRandomArbitary (min, max) {
return random() * (max - min) + min;
}
var seed = 1;
function random() {
var x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}
Am I missing something here?