Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Heinek

Unpin an element after gsap animation

Recommended Posts

Hi,

    I have created a gsap animation in my website. Inorder for it to autoplay i have not specified the duration while creating the scrollmagic scene. Now the animation is autoplaying (which is the intended effect if was going for) but now the section stays locked in place since there is no duration to tell the animation that it is over. So currently, the next elements are being overlapped by the pinned element. How can i fix this ? How can i unpin the element after the animation ?

See the Pen rNaKXmw by heinekhalwin (@heinekhalwin) on CodePen

Link to post
Share on other sites

Hey Heinek and welcome to the GreenSock forums!

 

ScrollMagic isn't a GreenSock product and we don't really support it here. But we'd like to help if we can - you likely don't need ScrollMagic for this sort of thing. 

 

What's the end goal/behavior that you're wanting? From your description I can't really tell.

Link to post
Share on other sites

Hi, 

      The effect i am going for is, i want the animation to stay pinned and to autoplay on reaching that element. Here, what is happening is, i'm using scrollmagic to pin the element in place till the animation is over. But since im not specifying the duration in scrollmagic, it stays pinned in place, even after the animation is over. Thanks for the speedy reply.

Link to post
Share on other sites

So you want:

  1. User to scroll to where the top of "TEXT 2" is at the top of their viewport.
  2. "TEXT 2" element pins to the top.
  3. "TEXT 2" element animates somehow.
  4. When the animation is finished, it unpins and goes back to it's original position.

Is this correct? There are several unknown parts and I want to understand your goal before writing code. 

Link to post
Share on other sites

Yes. That is what I was going for.

Link to post
Share on other sites

I had tried something similar to this but the problem is that Intersection Observer is not supported apple devices below iOS 13. So I couldn't get it to work. This is an awesome solution though.

Link to post
Share on other sites

Hi,

     Sorry for the late reply. But i managed to get it working in the way i wanted with scrollmagic's custom actions. Thanks for the help Zach, very much appreciated.

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.

×