Jump to content
Search Community

ScrollTrigger is failing with vite

wolfyglobal test
Moderator Tag

Recommended Posts

hello since i looked at the project a vite the program shows me failures in the animations. At the moment of loading the page for the first time, it does not show the animation, then it is the sample when it resizes the screens and the makers are always shown on top este es la captura del proyecto

 

 useEffect(() => {

    

    ScrollTrigger.matchMedia({
      'all':function(){
        const bgTl = gsap.timeline({
          scrollTrigger: {
            // trigger:q('.esenario'),
            trigger: heroRef.current,
            // trigger:heroRefDom,
            start: 'top top',
            // end:''
            end: '100% top',
            scrub: 1,
            markers: true,
          },
        })

        
    q('.img-bg').forEach(bg=>{
      const depth = bg.dataset.depth;
      const movement = window.innerHeight * depth;

      bgTl.to(bg,{
        y:movement
      },'-=1')
    })


    bgTl.to(q('.center-area'),{
      y:window.innerHeight*0.5
    },'-=1');
      }
    })
 },[])

 

Captura de pantalla (1082).png

 

I am using vite as a packager not npx-create-react-app

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...