question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature: kill animation instance

See original GitHub issue

First of all it is really the great animation library! Many thanks!

Is your feature request related to a problem? Please describe. I was surprised when kill animation instance possibility was not found. anime.remove(targets) is not the way I’m looking for because of this method doesn’t kill the animation at all, it just clears its target objects (rather it clears this target from all possible animations if I understand). So it seems that animation still stays in memory. And if I’ll call animation creation for 10 times will there be 10 instances of the animation?

Describe the solution you’d like A some solution to clear created animation from memory. Like this:

function animate({ view, easing = "linear", duration = 1000, start = 0 }) {
  const animeObj = {
    targets: view,
    easing,
    duration,
    complete: (animation) => {
      animation.kill();
    },
    autoplay: false
  };

  const animation = anime(animeObj);
  if (start === 0) {
    animation.play();
  } else {
    animation.seek(start);
    animation.play();
  }
}

If I want to play new animation on object I’ll create it again. I don’t want to save it in memory with a phantom possibility of reusing it again. No any thoughts about the combination of animation.pause() and anime.remove(targets) will help clear memory and unsubscribe the animation event.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:13
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kn0wncommented, Mar 30, 2020

Thanks for all the great thoughts on this feature - we will look into including it on the next major version (or maybe minor depending on scope)

2reactions
juliangarniercommented, Aug 31, 2022

It’s planned for the next release. Currently refactoring how the animations work internally and waiting for this part to be fully working and tested before introducing new methods to the API, like kill() or toggle(). Making good progress so far, but I stopped giving dates for release date since it always takes more time than expected.

Meanwhile, doing:

let animation = anime({…});
…
animation.pause();
animation = null;

Might be enough in some cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Killing Enemies + Animations! | Unreal and C++ Tutorial, Part 6
... create an Animation Blueprint (AnimBP) with a full state machine for the enemy, and modifying our collision and damage functionality to ...
Read more >
kill animation, am not understand. - GSAP - GreenSock
hi guys how i can kill all current animation from target objet ? ... i get `TypeError: TweenLite.kill is not a function` so...
Read more >
Stop an animation · Issue #188 · juliangarnier/anime - GitHub
If you want to cancel an animation with only the animation instance, I wrote a function that will gather all the targets, to...
Read more >
Controlling Anim Instances with Sequencer
Shows how to animate variables on anim instances through possessables.
Read more >
uaniminstance - Jolly Monster Studio
Yet again we are going to dive into Unreal Engine C++ Fundamentals by exploring UAnimInstance aka Animation Instance. The project for this tutorial...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found