Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate parallel actions #242

Closed
jedeen opened this issue Apr 3, 2014 · 1 comment · Fixed by #2322
Closed

investigate parallel actions #242

jedeen opened this issue Apr 3, 2014 · 1 comment · Fixed by #2322
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently

Comments

@jedeen
Copy link
Member

jedeen commented Apr 3, 2014

executing actions simultaneously

actor.parallel().moveTo().scaleTo.().endParallel()

will execute moveTo() and scaleTo() at the same time

@jedeen jedeen modified the milestones: vNext, 0.4 Release Apr 3, 2014
@jedeen jedeen modified the milestones: 0.4 Release, 0.5 Release Sep 30, 2014
@jedeen jedeen added the feature Label applied to new feature requests label Apr 30, 2015
@jedeen jedeen modified the milestones: 0.6 Release, 0.7 Release May 10, 2015
@jedeen jedeen added the on-deck label Jul 12, 2015
@jedeen jedeen modified the milestones: 0.7 Release, vNext Jul 12, 2015
@jedeen jedeen modified the milestones: vNext, Actions Jun 27, 2017
@jedeen jedeen removed the on-deck label Apr 20, 2018
@github-actions
Copy link

github-actions bot commented Jul 4, 2021

This issue hasn't had any recent activity lately and is being marked as stale automatically.

@github-actions github-actions bot added the stale This issue or PR has not had any activity recently label Jul 4, 2021
@eonarheim eonarheim removed this from the actions milestone Feb 1, 2022
eonarheim added a commit that referenced this issue May 27, 2022
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.

![parallel-actions3](https://user-images.githubusercontent.com/612071/169728361-3356cdbf-3d78-481a-9a1d-b6ed706cd04b.gif)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants