Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Leeroy J

Tween, ease in & ease out

Recommended Posts

Hi there,

What I want to do is have a tween that moves 250px right, has a Power3.easeIn and a Back.easeOut.

I can animate the Power3.easeIn fine but how to do get the Back.easeOut. at the end of this movement??
 

 

Power3.easeIn line of code:

TweenMax.to( $( '.mybox' ), 2, { right: 250, ease:Power3.easeIn}, 2);

Im sure its not too hard but I cant seem to work it out.
Thanks in advance.

 

 

Link to post
Share on other sites

How about splitting the tween into two parts.

 

  1. Tween the box to right 125 with an ease of Power3.easeIn with a duration of 1 second.
  2. Tween the box from 125 to 250 with an ease of Back.easeOut with a duration of 1 second.
  • Like 2
Link to post
Share on other sites

Just to add my two cents.. I would stick to animating only x and y. Animating left or right position offsets will give you poor performance since position offsets like top, left, bottom and right can only animate on a pixel level and can't take advantage of animating on sub-pixel level on a new layer rendering with the GPU for a much smoother animation. Also animating position offsets will cause layout thrashing since those CSS properties when animated have to constantly calculate layout again before painting and compositing to render.

 

Some helpful resources on this

 

https://css-tricks.com/myth-busting-css-animations-vs-javascript/

 

http://www.paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/

 

:)

  • Like 2
Link to post
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.

×