smooth as butter
This commit is contained in:
parent
538e0a9c31
commit
089ff4e274
@ -65,13 +65,14 @@ class ConstructAvatar extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
animateConstruct(this.props.id);
|
||||
this.idle = animateConstruct(this.props.id);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.avatarAnimation.id !== this.animId && nextProps.avatarAnimation.animTargetId === this.props.id) {
|
||||
this.animId = nextProps.avatarAnimation.id;
|
||||
anime({
|
||||
this.idle.pause();
|
||||
const anim = anime({
|
||||
targets: [document.getElementById(this.props.id)],
|
||||
translateY: nextProps.avatarAnimation.y * 200,
|
||||
translateX: nextProps.avatarAnimation.x * 200,
|
||||
@ -79,6 +80,7 @@ class ConstructAvatar extends Component {
|
||||
direction: 'alternate',
|
||||
duration: TIMES.SOURCE_DURATION_MS,
|
||||
});
|
||||
anim.finished.then(this.idle.play);
|
||||
}
|
||||
// console.log(this.props);
|
||||
// console.log(nextProps);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user