Akshata Posted July 27, 2023 Share Posted July 27, 2023 I'm doing animation between 2 videos. so when a user reaches the start position it will start properly but if the user stops scrolling between that, then it will look blank space .can we trigger the second step immediately after finishing 1st one.I don't want to see a second video entering the first one but it will like immediately fade in after scrolling up Link to comment Share on other sites More sharing options...
GSAP Helper Posted July 27, 2023 Share Posted July 27, 2023 It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer. Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo: See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt. Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. Link to comment Share on other sites More sharing options...
Akshata Posted July 27, 2023 Author Share Posted July 27, 2023 https://codesandbox.io/p/sandbox/gsap-react-vite-forked-395lf2?file=%2Fsrc%2FApp.tsx%3A111%2C35 if u see hereafter fade out 1st video , 2nd video slowly inserts can we do this transition faster Link to comment Share on other sites More sharing options...
mvaneijgen Posted July 27, 2023 Share Posted July 27, 2023 You can set snap: true to the ScrollTrigger, then it will snap to the specified points (start and end positions) when someone is done scrolling https://codesandbox.io/p/sandbox/gsap-react-vite-forked-lmysz5?file=%2Fsrc%2FApp.tsx%3A68%2C9 1 Link to comment Share on other sites More sharing options...
Rodrigo Posted July 27, 2023 Share Posted July 27, 2023 Hi, When working with React always use GSAP Context (gsap.context()) in order to avoid issues with the effect hooks double call in React Strict Mode (since version 18). Please take a look at the resources in this page: I'm a bit confused by your question though. It seems that you have a good grasp on ScrollTrigger duration as I see that you have this in your config: scrollTrigger: { trigger: '.mainbox', start: 'center center', // animation start at this point end: 'bottom center ', // animation end at this point // end: '+=1500', markers: true, scrub: true, pin: true, invalidateOnRefresh: true, immediateRender: true, }, You commented out the +=1500 end point there, assuming that it was too long. You can still use a small relative value to make a shorter transition. Maybe play with the different easing functions to see if another one gets you better results: https://greensock.com/docs/v3/Eases Finally take a look at this video @Cassie made just in case: Hopefully this helps. Happy Tweening! Link to comment Share on other sites More sharing options...
Akshata Posted July 27, 2023 Author Share Posted July 27, 2023 Type 'true' is not assignable to type 'number | number[] | "labels" | "labelsDirectional" | SnapFunc | SnapVars | undefined' gsap:3.12.2 throwing error Link to comment Share on other sites More sharing options...
GreenSock Posted July 27, 2023 Share Posted July 27, 2023 35 minutes ago, mvaneijgen said: You can set snap: true to the ScrollTrigger, then it will snap to the specified points (start and end positions) when someone is done scrolling snap is not supposed to be a Boolean, no. But if you want it to snap to the start or end, you could do snap: 1 or snap: [0, 1] 1 1 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