From f124cc07c541330feaa29f8a82e3623457e99f67 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 25 Mar 2022 07:06:49 -0500 Subject: [PATCH] fix: method --- packages/timing/src/traits/animated.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/timing/src/traits/animated.js b/packages/timing/src/traits/animated.js index b173e21..a5cbc25 100644 --- a/packages/timing/src/traits/animated.js +++ b/packages/timing/src/traits/animated.js @@ -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];