Jump to content
Search Community

yousoumar

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by yousoumar

  1. 41 minutes ago, GreenSock said:

    You definitely shouldn’t be using the @types/greensock package - that was never from GreenSock (someone else made it) and it hasn’t been updated in 5+ years. 

     

    The GSAP package itself comes with TypeScript definition files so you shouldn’t need to install anything else. 

    Thanks for pointing out. I didn't know. I deleted it, changed my .eslitnrc parser to  @typescript-eslint/parserand the error is gone.

    • Like 1
  2. Hi guys !

     

    I installed @types/greensock and started using Gsap with TypeScript. Everything works fine, but the ScrollTo plugin is giving this eslint error (image attached). Someone knows something about it ? At least I want to be able to tell eslint to ignore this error.  

     

    Thank you !

    import { ScrollToPlugin } from "gsap/ScrollToPlugin";
    import { gsap } from "gsap";
    gsap.registerPlugin(ScrollToPlugin);
    
    export const headerInteractionHandler = () => {
      document.querySelector("header .logo").addEventListener("click", (e) => {
        e.preventDefault();
        let element = <HTMLAnchorElement>e.currentTarget;
    
        gsap.to(window, {
          duration: 0.8,
          scrollTo: `${element.getAttribute("data-destination")}`,
        });
      });
    };

    Screenshot 2022-01-23 at 17.17.31.png

  3. 14 minutes ago, Cassie said:

    Hey there,

     

    Sure thing, you can use a stagger and set a dynamic end point for the trigger. 
     

     

     

    Hope this helps!

    Thank you so much @Cassie ! Tough the thing is, I wanna animate some elements inside each project card before going to the next one, don't know if it is possible. Here is the complete  timeline for a project. 

     timeline
            .from(
              ".project",
              {
                autoAlpha: 0,
              }
            )
            .from(".project .image", {
              autoAlpha: 0,
              y: -100,
            })
            .from(".project .description", {
              autoAlpha: 0,
            })

     

    • Like 1
  4. Thank you so much @Cassie ! Tough the thing is, I wanna animate some elements inside each project card before going to the next one, don't know if it is possible. Here is the complete  timeline for a project. 

          timeline
            .from(
              ".project",
              {
                autoAlpha: 0,
              }
            )
            .from(".project .image", {
              autoAlpha: 0,
              y: -100,
            })
            .from(".project .description", {
              autoAlpha: 0,
            })

     

  5. Hi guys ! I got this code for animating my video, it works fine on Safari, but on Chrome & Firefox, it jumps to some duration suddenly. I am missing something ? ref is  an HTML element reference. I am using gsap in a Next app. Thanks ! 

    export function useAnimOnScroll(ref) {
      let video = ref.current.querySelector("video")!;
      let tl = gsap.timeline({
        scrollTrigger: {
          trigger: ref.current,
          scrub: true,
          start: "top top",
          end: "bottom top",
          markers: true,
          pin: true,
        },
      });
      tl.to(video, {
        currentTime: video.duration - 2,
      });
    }
  6. I am having a hard time with ScrollTrigger in my Next app. Here is my code below. I am expecting markers and my animation to fire on scroll, but I get my animation on load and not my markers.

     

    import { gsap } from "gsap/dist/gsap";
    import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
    gsap.registerPlugin(ScrollTrigger);
    
    import { useEffect, useRef } from "react";
    export default function Services() {
      const servicesRef = useRef();
      useEffect(() => {
        let tl = gsap.timeline({
          ScrollTrigger: {
            trigger: servicesRef.current,
            markers: true,
          },
        });
    
        tl.to(servicesRef.current.querySelector("h1"), {
          color: "white",
        });
      }, []);
      return (
        <section className="services" ref={servicesRef}>
          <h1>Nos services</h1>
        </section>
      );
    }

     

×
×
  • Create New...