Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
stephanberger4

trace the current position of my rotating gear

Recommended Posts

Hi, 

 

I've got a gear that rotates each time I click on it :

 

gear1.addEventListener(MouseEvent.CLICK, turn_gear1, false, 0, true);



function turn_gear1(event:MouseEvent):void{

TweenLite.to(gear1, 1, { rotation: "+=10", ease: Linear.easeNone });

}

 

Is there a way to trace the current position of the gear each time it has finish the rotation ? Cause I would like to trigger a function when the gear is in a specific position.

 

Thanks for your help, 

 

Share this post


Link to post
Share on other sites

sounds like you could use an onComplete callback like

function turn_gear1(event:MouseEvent):void{

TweenLite.to(gear1, 1, { rotation: "+=10", ease: Linear.easeNone, onComplete:getRotation});

}



function getRotation() {

trace(gear1.rotation);

}

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×