Jump to content
Search Community

How to animate to an element?

elschnuppero 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 there,

 

i'm currently building a site, where the user is scrolling through content horizontally (yeah i know, its a client request). In this content i implemented some aweful scrollstops with "overflow: hidden" on body & html (yeah, i know again, tell the client pls :)) 

 

The user can remove the  "overflow: hidden" by clicking a button and the protagonist in the scene will be animating to a certain point and then keeps on scrolling.

 

The problem i have  is: The scrollstops arent very reliable and it can happen - depending on the scrollspeed - that the triggerelement triggers the scrollstop too late. This reduces the space to the point where the protagonist in the scene is animating to and this is why i whonder if there is a possibility to animate to a certain element and not with values? (right now in this second i realised that i just could calculate the value between the two elements somehow, but maybe there is an easy way to this problem)

 

Thank you

See the Pen GELNRo by ElSchnuppero (@ElSchnuppero) on CodePen

Link to comment
Share on other sites

Hi @elschnuppero :)

 

Welcome to the forum.

 

I'm not sure I completely understand the question and it seems to be more about ScrollMagic rather than GSAP. That being said, if you want to tween to a specific div, the ScrollTo plugin can take care of that for you and you can easily scroll horizontally.

 

https://greensock.com/docs/Plugins/ScrollToPlugin

 

Hopefully that helps. Happy tweening.

:)

 

  • Like 1
Link to comment
Share on other sites

Thank you for your response.

 

Its a little bit tough to explain. The issue is not related to scrollmagic. I dont want to scroll to a div (but i will probably rely on that in case i dont find another solution), i want an object animate to a div thats not necessarily having the same distance to the object (the distance might relate to the scrollspeed of the user).

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