Jump to content
GreenSock

swiftmend

Reorient child MC when parent is orient to bezier

Recommended Posts

Hi,

 

I'd like to have a movie clip that follows a Bezier path with its rotation oriented toward its path as per normal with the usual orientToBezier: true.

 

However the twist is I need a child of that movie clip to have a movie clip that doesn't rotate along with it, so I need to correct its rotation every frame to make it up right.

 

Any ideas on this one?

Link to comment
Share on other sites

ahh, this reminds me of my AS3 Code Challenge:

 

http://www.snorkl.tv/2011/06/as3-code-c ... #more-1007

 

the general idea is that you need:

 

onUpdate callback to constantly rotate the child clip

you need an equation in the onUpdate that rotates the child clip the proper amount of degrees.

 

Here is an example:

 

http://snorkl.tv/dev/bezierChild/

 

here is some sample code:

 


import com.greensock.*; 
import com.greensock.easing.*;

TweenMax.to(arm, 3, {bezierThrough:[{x:136, y:115}, {x:209, y:178}, {x:328, y:128}], delay:.5, orientToBezier:true, onUpdate:fixBox});

function fixBox(){
trace(arm.rotation);
arm.box.rotation = 0-arm.rotation;
}

 

fla attached

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.
×