Detrol Posted April 1, 2023 Share Posted April 1, 2023 Hey! So i love the demo typewriter, as in the one found here But, how can i combine it with scrolltrigger, so it will start "typing" when i scroll down to that section, and not as soon as i load the page? Thank you in advance! See the Pen RwBwJBm by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Solution Detrol Posted April 2, 2023 Author Solution Share Posted April 2, 2023 I got it sorted after some sleep. Wasn't so difficult, just a tired brain. const myTextElement = document.getElementsByClassName("jag-decoy"); const timePerCharacter = 0.02; gsap.to(".jag", { scrollTrigger: { trigger: ".jag", toggleActions: "play", start: "top 90%", end: "bottom 50%+=100px", }, text: { value: myTextElement[0].innerHTML }, duration: myTextElement[0].innerText.length * timePerCharacter, delay: 0.5, ease: "none", delimiter: " " }) 3 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