Jump to content
Search Community

Random Tween Rotation

Luigi Vercotti test
Moderator Tag

Recommended Posts

Hello

var timeline:TimelineLite = new TimelineLite();
var Pics:Array = [testRot05, testRot02, testRot06, testRot04, testRot, testRot03];
var i:Number= Pics.length;
while (i--) {
   timeline.insert( TweenLite.from(Pics[i], 1, {y:0, rotationZ:180, rotationY:180, rotationX:360, alpha:0}), i * 1);
}

 

The code above works, no problem.

If you can please advice me how to do like each picture goes from different rotationZ/Y/X and stop at the correct position (pictures). I probably could do each picture separate, but that's gonna take me some time as I will have 35 of them (5rows and 7colloms).

Please ;)

Link to comment
Share on other sites

I don't understand the question. Could you give more details about exactly what you want? Are you asking for code that will randomize the beginning rotationX/rotationY/rotationZ? Are you asking for code that will place things in 5 rows and 7 columns? Do the objects already start in the correct position?

  • Like 1
Link to comment
Share on other sites

I'm sorry for my English :?

OK, finally there will be 5 rows and 7 columns (35 pictures/movie clips) and yes, they can start from one position, but if they can randomly begin rotationX/rotationY/rotationZ, but they must stop at the correct position, because they are pictures.

Link to comment
Share on other sites

Do you need to know how to place these objects in rows and columns or do you already have them in position? If you just need to know how to make them randomly start from various rotations, simply do:

 

var timeline:TimelineLite = new TimelineLite();
var Pics:Array = [testRot05, testRot02, testRot06, testRot04, testRot, testRot03];
var i:Number= Pics.length;
while (i--) {
   timeline.insert( TweenLite.from(Pics[i], 1, {y:0, rotationZ:Math.random() * 360, rotationY:Math.random() * 360, rotationX:Math.random() * 360, alpha:0}), i * 1);
}

Link to comment
Share on other sites

I want to add onComplete:onFinishMainPic

timeline.insert( TweenLite.from(Pics[i], 1, {y:0, rotationZ:Math.random() * 360, rotationY:Math.random() * 360, rotationX:Math.random() * 360, alpha:0, onComplete:onFinishMainPic}), i * 1);
}

but it doesn't work. What do you think? Please ;)

Link to comment
Share on other sites

Hello Greensock

Your code from earlier works pretty fine.

Later I am trying to use it on some another picture/movie clip and I don't know why it never stop at the correct position (rotated position), even if I use rotation X/Y/Z without Math.random(), only with 360. So, it supposed to just turn around, isn't it? I am guessing it has something to do with height: and width: ...but I don't know why....

Do you have any idea? ;)

 

var patron_mc:TimelineLite = new TimelineLite();
patron_mc.insert(TweenLite.to(patron, 2, {alpha:1, x:175.6, y:185, width:310, height:110, rotationY:Math.random() * 360, rotationX:Math.random() * 360, ease:Strong.easeIn}));

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...