Heinek Posted January 14, 2020 Share Posted January 14, 2020 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 comment Share on other sites More sharing options...
ZachSaucier Posted January 14, 2020 Share Posted January 14, 2020 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 comment Share on other sites More sharing options...
Heinek Posted January 15, 2020 Author Share Posted January 15, 2020 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 comment Share on other sites More sharing options...
ZachSaucier Posted January 15, 2020 Share Posted January 15, 2020 So you want: User to scroll to where the top of "TEXT 2" is at the top of their viewport. "TEXT 2" element pins to the top. "TEXT 2" element animates somehow. 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 comment Share on other sites More sharing options...
Heinek Posted January 15, 2020 Author Share Posted January 15, 2020 Yes. That is what I was going for. Link to comment Share on other sites More sharing options...
ZachSaucier Posted January 15, 2020 Share Posted January 15, 2020 I'd do something like this, no need for ScrollMagic. See the Pen KKwBYwP?editors=0010 by GreenSock (@GreenSock) on CodePen Notice that you don't need to put quotation marks around numerical values. 1 Link to comment Share on other sites More sharing options...
Heinek Posted January 15, 2020 Author Share Posted January 15, 2020 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 comment Share on other sites More sharing options...
ZachSaucier Posted January 15, 2020 Share Posted January 15, 2020 9 minutes ago, Heinek said: the problem is that Intersection Observer is not supported apple devices below iOS 13 So use a polyfill which has better support and smaller file size than ScrollMagic: https://github.com/w3c/IntersectionObserver/tree/master/polyfill#browser-support 1 Link to comment Share on other sites More sharing options...
Heinek Posted January 18, 2020 Author Share Posted January 18, 2020 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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now