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