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.

The way animations are played in Excalibur is non-intuitive

See original GitHub issue

Currently to play an animation you need to call addDrawing('animationName', anim) setDrawing('animationName') to play an animation, then the animation plays as a side effect.

Problems:

  • No way of knowing when the animation is done
  • It is ackward to script out an animation sequence
  • addDrawing and setDrawing don’t scream “use me to animate”
  • No way to have an “invisible” animation

Possible implementation


// internal animations collection
var MyActor extends ex.Actor {
   someMethod() {
      // returns a promise that is resolved when the animation is complete
      this.animations('run').play().then(() => {
          this.animations('jump');
      });
   }
}

actor.addAnimation('key', anim);
//alias
actor.add('key', anim)

// in the case of looping animations, the promise resolves when the animation is switched
var done = actor.animations('looping').play()

// the "done" promise resolved
// additionally the "play" animation can take an optional delay parameter
var newanimdon = actor.animations('explode').play(200)

// to stop the current animation, doing a "freeze frame" on the current animation. 
// Resolving the promise of the current animation
actor.animations.stop()

// to have the drawing be invisible call
actor.animations.none();

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
alanag13commented, Apr 25, 2016

You could consider doing something like an IPlayable interface to keep these sorts of things in check.

0reactions
eonarheimcommented, Jun 12, 2021

Closed by #1730

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animation | Excalibur.js Edge API Documentation
Animations allow you to display a series of images one after another, creating the illusion of change. Generally these images will come from...
Read more >
Excalibur's Radial Blind "LoS" is going too far... - Warframes
For instance If Excal is behind a crate, enemies on the other side of the crate are not affected? That is a real...
Read more >
Why are players so sensitive when discussing how ...
And I hope that player is having fun playing the content, regardless of their skill ... no character animation indicating 0 uptime, etc)....
Read more >
Petition: Keep the Animation!~ - Page 4
Hello Rokien here with another petition! I hope everyone's Tuesday is going well! Mine was till I read: "While the animations were nice,...
Read more >
Another thread about King Arthur
I attriubute this to his play difficulty and unintuitive play. Players here seem to play the game in such a way that it's...
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 Reddit Thread

No results found

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