Actions would still be accessed off of the actions component of an entity
const actor = new ex.Actor({pos: ex.Vector.Zero, width: 10, height: 10});
// Move actor one action at a time serially
// Move actor to position (200, 200) in world space at 100 pixels/sec
let moveToComplete = await actor.actions.moveTo(200, 200, 100);
// Move actor relative to it's current position to the right 100 at 100 pixels/sec
let moveByComplete = await actor.actions.moveBy(100, 0, 100);
// Move actor and rotate concurrently
// Move actor to position (0, 0) in world space and rotate to PI/2 at the same time
let moveToAndRotateComplete = await Promise.all([
actor.actions.moveTo(0, 0, 200),
actor.actions.rotateTo(Math.PI / 2, .2)
]);
Context
Currently the Actions API uses a fluent API that doesn't easily allow the user to compose simultaneous actions or to know when they are completed.
Proposal
Taking inspiration from Xamarin.Forms, thanks @alanag13 https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/animation/simple#composite-animations
I propose a new Action API
Actions would still be accessed off of the actions component of an entity