Answer the question
In order to leave comments, you need to log in
Why doesn't GSAP animation work in a React component?
import TweenLite from 'gsap/umd/TweenLite';
class Background extends React.Component {
constructor(props) {
super(props);
this.frame = React.createRef();
}
componentDidMount() {
TweenLite.set(this.frame.current, { width: 0, height: 0, opacity: 0 });
TweenLite.to(this.frame.current, 10, { width: '50%', height: '60%', opacity: 1 });
}
render() {
const { children } = this.props;
return (
<div className="background" ref={this.frame}>
<div className="background__content">
{children}
</div>
</div>
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question