Jump to content
Search Community

Find the end of bezier rotate

anotheruser test
Moderator Tag

Recommended Posts

Hi, 

Sorry for buggin you again , Let me tell you a scenario which am facing right now , I have a mc which will move along the bezier curve and a button which will start the play and bezier points , you have an autorotate option where you will rotate the mc along the path. so i need to know what rotation will the mc will be at the end of play , because when auto rotate is enabled my rotation at start will be 0 but by the end of the play it will be ???? i need to know that value before the tween happens , please help!

Link to comment
Share on other sites

it sounds like you can just set the progress(0) (at the end), grab the rotation, and then set the progress(0) again. This will all happen without rendering the object in the final position between frame updates.

var tween:TweenLite = TweenLite.to(mc, 1, {bezier:{...}, paused:true});
tween.progress(1);
trace(mc._rotation);
tween.progress(0);
  • Like 2
Link to comment
Share on other sites

Hey i got another serious issue , now from the following pic you can see that the bezier path is set

 

Capture.png

 

and when you click tween the mc automatically turns upside down or anything based on the curve , like right now its around 180 degree and for a different curve the starting rotation is different , how can i find the first initial rotation so that i can reduce it and make it play from 0 rotation

 

Capture2.png

 

I hope you understand what i mean , i am trying to run the bezier where the initial rotation doesnt change , i know we can change the autorotate array for bezier but for that i need to know the initial rotation or tell me how can i make my mc not rotate and auto rotate along the same initial rotation along the path ?

 

 

Link to comment
Share on other sites

hmm, if I understand correctly you could do something similar to how we suggested you get the end rotation. Jump the progress() ahead a little and grab the rotation and then tween to it.

 

something like:

 

var bez = TweenMax.to(mc, 8, {paused:true, bezier:{autoRotate:true, values:[{x:35, y:99}, {x:300, y:345}]}})
bez.progress(0.001);
var startRotation = mc.rotation;
bez.pause(0);


var rot = TweenLite.to(mc, 1, {rotation:startRotation, delay:1, onComplete:function() {bez.progress(0.001).play()}})
 
there may be a better way but I'm not sure at the moment. If you need more help it really helps if you can provide a super simple demo.
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...