Jump to content
Search Community

Tweening Half The Distance.

vmedium test
Moderator Tag

Recommended Posts

I always use this little trick, that simulates easing:

 

private function onEnterFrame(e:Event)

{

var startRotationY = boxContainer.rotationY;

var startRotationX = boxContainer.rotationX;

 

var destRotationY = -boxContainer.mouseX/80;

var destRotationX = boxContainer.mouseY/80;

 

 

boxContainer.rotationY += (destRotationY - startRotationY)/2

boxContainer.rotationX += (destRotationX - startRotationX)/2

 

 

}

 

What is the best way to achieve this effect with TweenMax?

 

vmedium

Link to comment
Share on other sites

keep in mind what you are doing isn't really a tween. A tween typically has a duration, start value and end value.

 

the motion you are creating has a duration that is virtually infinite (depending on how long the user is moving the mouse) and the end values can change many times.

 

I would suggest starting with just a few simple tweens and find the easing equation that suits your needs.

 

TweenMax.to(boxContainer, .5, {rotationX:destRotationX, rotationY:destRotationY, ease:Quint.easeOut}) 

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