Thank you!
I can't get it to work yet, but I'm understanding the concept better.
I tried making a few changes, thinking maybe it just needed the myRotation variable instead of the randomNumber variable in the Tween code. And I tried adding in the "+=" also - neither one helped at all so I'm guessing those things were not the issue! Can you tell what's wrong with the below?
pie.onload = function(){
var myRotation = randomNumber(1,6) * 72;
trace(myRotation);
TweenMax.to('#wheel', 7, {delay:1, directionalRotation:"+=" + myRotation + "_cw", ease:Power4.easeInOut, duration:5});
};
function randomNumber(min:Number, max:Number):Number {
return Math.floor(Math.random() * (1 + max - min) + min);
}
ETA:
I made some more changes based on the GSAP docs - I feel like this SHOULD be working now - but its not:
jQuery(document).ready(function() {
var pie = new Image();
pie.src = "pie.png";
pie.onload = function(){
function randomNumber(min:Number, max:Number):Number {
//good
return Math.floor(Math.random() * (1 + max - min) + min);
}
var myRotation = randomNumber(7,11) * 72;
trace(myRotation);
TweenMax.to('#wheel', 7, {delay:1, directionalRotation: (myRotation + "_cw"), ease:Power4.easeInOut});
};
jQuery("#rightarrow").on('click', function(){
TweenMax.to('#wheel', 1, {directionalRotation:"+=72_cw", ease:Back.easeOut});
});
jQuery("#leftarrow").on('click', function(){
TweenMax.to('#wheel', 1, {directionalRotation:"-=72_ccw", ease:Back.easeOut});
});
});
Any pointers will be greatly appreciated!!