Skip to content

Commit

Permalink
Merge pull request #2635 from framer/fix/bound-stop
Browse files Browse the repository at this point in the history
Binding `stop()` to animation
  • Loading branch information
mergetron[bot] committed Apr 19, 2024
2 parents ea49a4d + 3b53f22 commit 0d72893
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ export class MainThreadAnimation<
this.holdTime = this.currentTime ?? 0
}

stop() {
/**
* This method is bound to the instance to fix a pattern where
* animation.stop is returned as a reference from a useEffect.
*/
stop = () => {
this.resolver.cancel()
this.isStopped = true
if (this.state === "idle") return
Expand Down

0 comments on commit 0d72893

Please sign in to comment.