payne199 Posted February 24 Share Posted February 24 It seems that the duration property of my tween acts on all other properties except for the color property. I am simply wanting a gradual change in color from black to brown. Would someone enlighten me on this? const Title = () => { const [titleColor, setTitleColor] = useState(true); const title = useRef(null); useLayoutEffect(() => { let ctx = gsap.context(() => { gsap.to(title.current, { duration: 3, x: "20px", color: "brown", scale: 1.5, ease: "power1.in" }); }, titleColor); return () => ctx.revert(); }, [titleColor]); return ( <div className="container"> <p className="title" ref={title}> Title </p> </div> ); }; Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted February 24 Solution Share Posted February 24 If you set a hex color it works. Also highly recommend reading the following article if you're using react https://gsap.com/react If you need further assistance, please provide a minimal demo, so that we can take a look at your code in action. Hope it helps and happy tweening! See the Pen WNmqLOK?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen 1 Link to comment Share on other sites More sharing options...
payne199 Posted February 25 Author Share Posted February 25 Thanks for the knowledge and article link. I got some studying to do 🙂. 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