fix: method

This commit is contained in:
cha0s 2022-03-25 07:06:49 -05:00
parent 0681b3a998
commit f124cc07c5

View File

@ -163,11 +163,6 @@ export default (flecks) => class Animated extends decorate(Trait) {
}
},
setAnimationRate: (rate) => {
this.#animations[this.#currentAnimation].frameRate = rate;
this.#forceUpdate = true;
},
startedDying: () => {
this.isAnimating = false;
},
@ -217,6 +212,17 @@ export default (flecks) => class Animated extends decorate(Trait) {
this.#currentAnimation = this.state.currentAnimation;
}
methods() {
return {
setAnimationRate: (rate) => {
if (this.#animations[this.#currentAnimation].frameRate !== rate) {
this.#animations[this.#currentAnimation].frameRate = rate;
this.#forceUpdate = true;
}
},
};
}
offsetFor(key) {
if (!(key in this.params.animations) || !this.params.animations[key].offset) {
return [0, 0];