Jump to content
Search Community

Lopdog

Members
  • Posts

    3
  • Joined

  • Last visited

Lopdog's Achievements

  1. Figured it out. Below is for anyone who wants any text to animate, regardless of color. gsap.registerPlugin(ScrollTrigger); const splitTypes = document.querySelectorAll('.text-split'); splitTypes.forEach((char,i) => { const text = new SplitType(char, {types: ['chars','words']}); gsap.from(text.chars, { scrollTrigger: { trigger: char, start: 'top 80%', end: 'top 20%', scrub: true, markers: false }, opacity: 0.2, stagger: 0.1, }) });
  2. Gotcha, thanks for the help. Hopefully, this works. https://codepen.io/Lopdog/pen/XWGvjxW
  3. Greetings all! I'm a scripting noob-uh that needs some guidance. I have the animation up and running for all-black text on a white background. I need to do the same for white text on a black background. Below is what I have so far. Any help in understanding the script needed to make this work is greatly appreciated. The website. gsap.registerPlugin(ScrollTrigger); const splitTypes = document.querySelectorAll(".text-split"); splitTypes.forEach((char, i) => { const bg = "#F1F1F1"; const fg = "#000000"; const text = new SplitType(char, { types: "chars" }); // Update on window resize let windowWidth = $(window).innerWidth(); window.addEventListener("resize", function () { if (windowWidth !== $(window).innerWidth()) { windowWidth = $(window).innerWidth(); typeSplit.revert(); runSplit(); } }); gsap.fromTo( text.chars, { color: bg }, { color: fg, duration: 1, stagger: 1, opacity: 1, scrollTrigger: { trigger: char, start: "top 80%", end: "top 35%", scrub: true, markers: false, toggleActions: "play play reverse reverse" } } ); });
×
×
  • Create New...