Jump to content
Search Community

Animated from bottom left to center only using x, y?

martis test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi guys,

 

I am trying to position an object in the bottom left corner and tween it to the center of the window.

 

I am trying to avoid animating left/top or wrapping it in a 100% height, width div with xPercent, yPercent for performance reasons.

 

As you can see it works, but once you resize the window it breaks down.

 

Is there any way to achieve this only using x, y without rebuilding the timeline on resize? (It's part of a much larger timeline)

 

Much appreciated!

See the Pen OWQvdY by anon (@anon) on CodePen

Link to comment
Share on other sites

HI martis :)

 

If I understand your question correctly, you'll need to recreate the timeline for a new window size. Please see the following threads:

 

https://greensock.com/forums/topic/15758-destroy-current-timeline-initiate-new-one-on-window-resize/

https://greensock.com/forums/topic/14892-reposition-animation-on-screen-resize/

 

Hopefully that helps a bit.

 

Happy tweening.

:)

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