Jump to content
Search Community

GSAP x and y animations breaks my layout

FeranD 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

I am using GSAP for last 3 weeks and, first i'd like to say, its and outstanding, great tool. Thanks a lot and cheers cheers to developers.

I have a simple animations using .from method with {x: or y:} properties changes.

Problem came out when i started to look at my website in a mobile Firefox layout.

Some elements have {x: 150} with a .from method and a ScrollMagic (triggerHook: "onCenter") appearance. I guess that keeps them 150px to the right from its original position. And that behaviour largen my screen and breaks layout making an ugly vertical line to appear (same as when u try to resize screen to a smaller size with some fixed width elements, you know what i mean :))

 

How do i fix this ?

Link to comment
Share on other sites

So, i need something like autoAlpha but working with display: none, so elemets that has {x: 100} (moved out of screen and breaks mobile layouts) and have not yet been triggered by ScrollMagic to come to their in-width places will be out of flow and not break layout.

Hope you understand my Russian-English, sorry 

Link to comment
Share on other sites

Hey, guys. Thx for a good pleasant welcome. 

I've scratched a very very simple example illustrating my problem - 

See the Pen JjPWRQK by antongrekov (@antongrekov) on CodePen

 

Before animation completes you may notice a horizontal scrollbar on the bottom. That overwidtrh breaks my mobile layout and makes my header stretchen full-width and display incorrectly, also it makes a gray vertical line appear right to all website.

 

overflow: hidden on body or html is not a solution for me cuz i need a vertical scroll on page. I may apply overflow: hidden on section with that animation but i also don't like this solution(what is section is big or it suppose vertical scroll on some elements). 
Perfect solution would be something like autoAlpha but with display: none before animation, or applying a position: absolute to animated element

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