fix sketchy idle animation
This commit is contained in:
parent
0a0db9e57f
commit
c3a8463ea9
@ -59,8 +59,13 @@ class AccountAvatar extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.idle = idleAnimation(this.props.account.id);
|
||||
return this.animations.push(this.idle);
|
||||
const startIdle = () => {
|
||||
this.idle = idleAnimation(this.props.account.id);
|
||||
this.animations.push(this.idle);
|
||||
this.idle.finished.then(startIdle);
|
||||
};
|
||||
|
||||
startIdle();
|
||||
}
|
||||
|
||||
resetAnimations() {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
const anime = require('animejs').default;
|
||||
|
||||
function idle(id) {
|
||||
const duration = anime.random(2000, 18000);
|
||||
const duration = anime.random(2000, 4000);
|
||||
const target = document.getElementById(id);
|
||||
|
||||
return anime({
|
||||
targets: target,
|
||||
translateX: () => anime.random(-20, 20),
|
||||
@ -10,8 +11,7 @@ function idle(id) {
|
||||
rotate: () => anime.random(-15, 15),
|
||||
duration,
|
||||
direction: 'alternate',
|
||||
easing: 'linear',
|
||||
loop: true,
|
||||
easing: 'easeInOutSine',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -48,8 +48,13 @@ class ConstructAvatar extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.idle = idleAnimation(this.props.construct.id);
|
||||
return this.animations.push(this.idle);
|
||||
const startIdle = () => {
|
||||
this.idle = idleAnimation(this.props.construct.id);
|
||||
this.animations.push(this.idle);
|
||||
this.idle.finished.then(startIdle);
|
||||
};
|
||||
|
||||
startIdle();
|
||||
}
|
||||
|
||||
resetAnimations() {
|
||||
|
||||
@ -34,8 +34,13 @@ class MnniAvatatr extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.idle = idleAnimation('mnni');
|
||||
return this.animations.push(this.idle);
|
||||
const startIdle = () => {
|
||||
this.idle = idleAnimation('mnni');
|
||||
this.animations.push(this.idle);
|
||||
this.idle.finished.then(startIdle);
|
||||
};
|
||||
|
||||
startIdle();
|
||||
}
|
||||
|
||||
resetAnimations() {
|
||||
|
||||
@ -37,8 +37,13 @@ class Img extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.idle = idleAnimation(this.props.id);
|
||||
return this.animations.push(this.idle);
|
||||
const startIdle = () => {
|
||||
this.idle = idleAnimation(this.props.id);
|
||||
this.animations.push(this.idle);
|
||||
this.idle.finished.then(startIdle);
|
||||
};
|
||||
|
||||
startIdle();
|
||||
}
|
||||
|
||||
resetAnimations() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user