Jump to content


gsap."from" is not working when used with scrolltrigger

Moderator Tag

Recommended Posts

import "./component.scss";
import CSSRulePlugin from "gsap/CSSRulePlugin";
import ScrollTrigger from "gsap/src/ScrollTrigger";
import gsap from "gsap";
import { useEffect, useRef } from "react";

const Heading = (props) =>{
    let headingContainer = useRef(null);
            {scrollTrigger:{trigger:headingContainer,start:"top center",toggleActions:"restart none none none"}, duration:1,
        <div className="heading-container" ref={el=>{headingContainer=el}}>
            <div className="heading-content">
            <div className="heading-diamond"></div>
export default Heading
Link to comment
Share on other sites

When I try to use it, as soon as the it is triggered it goes from x:50 i.e translate(50px,0px) to translate3d(0,50px,0), also autoAlpha:0 doesn't get triggered. I am using react.

Link to comment
Share on other sites

Also, Its going back to its initial x:50

Link to comment
Share on other sites

Without a minimal demo very hard to say whats wrong 

If you want create demo with React you can use codesandbox

The presented code is not enough to understand what the problem is

  • Like 2
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.