feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
fix: #1891 Re-arrange repeat/repeatForever api + new tests (#1896)
Closes #1891
Bonus Closes #635
## Changes:
- Changes the repeat/repeatForever api to be more clear (breaking change, no longer introspects the current action queue)
```typescript
a.actions
.easeTo(10, 100, 1000, EasingFunctions.EaseInCubic)
.delay(250)
.repeat(repeatBuilder => {
// Specific actions to repeat
repeatBuilder
.easeTo(100, 100, 1000, EasingFunctions.EaseInCubic)
.delay(250)
.easeTo(10, 100, 1000, EasingFunctions.EaseInCubic)
.delay(250)
}, 2); // Repeats twice
```
- Light refactoring to actions
- Separate action types into separate files
- Change ActionContext to only support 1 actor at a time (multi actor unused after groups was deprecated long ago)
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type
feat: [#242] Implement Parallel Actions (#2322)
Closes #242
This PR implements 2 new `Action` types to enable running parallel actions. `ActionSequence` which allows developers to specify a sequence of actions to run in order, and `ParallelActions` to run multiple actions at the same time.

Example, moves the actor in a box while rotating it at the same time
```typescript
var sequence1 = new ex.ActionSequence(actor, ctx => {
ctx.easeBy(ex.vec(200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, 200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(-200, 0), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
ctx.easeBy(ex.vec(0, -200), 1000, ex.EasingFunctions.EaseInOutCubic);
ctx.delay(500);
});
var sequence2 = new ex.ActionSequence(actor, ctx => {
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.Clockwise);
ctx.delay(500);
ctx.rotateBy(Math.PI, Math.PI, ex.RotationType.CounterClockwise);
ctx.delay(500);
});
var parallel = new ex.ParallelActions([sequence1, sequence2]);
actor.actions.repeatForever(ctx => ctx.runAction(parallel));
```
## Changes:
- Fix some bugs in existing action types
- Add the missing `EaseBy` action type
- Add new `ActionSequence` action type
- Add new `ParallelActions` action type