Skip to content

Instantly share code, notes, and snippets.

@cheapsteak
Forked from anonymous/box.jsx
Created January 24, 2017 02:47
Show Gist options
  • Save cheapsteak/4f5ae02e62a3bbd2611b3a37847aac9a to your computer and use it in GitHub Desktop.
Save cheapsteak/4f5ae02e62a3bbd2611b3a37847aac9a to your computer and use it in GitHub Desktop.
class Box extends React.Component {
componentWillEnter (callback) {
const el = this.container;
TweenMax.fromTo(el, 0.3, {y: 100, opacity: 0}, {y: 0, opacity: 1, onComplete: callback});
}
componentWillLeave (callback) {
const el = this.container;
TweenMax.fromTo(el, 0.3, {y: 0, opacity: 1}, {y: -100, opacity: 0, onComplete: callback});
}
render () {
return <div className="box" ref={c => this.container = c}/>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment