funkaster/ChesterGL — Issue #4: time-dependent actions
Author: funkaster
Created: 2011-10-22 03:09:27+00:00
State: open

time dependent actions are not working (just a stub). My idea for the actions API is the following:

```javascript
// 1) moves instantly
block.moveTo([x, y, 0]);
// 2) schedules an action to be executed immediately and should take 2.0 seconds
block.moveTo([x, y, 0], 2.0);
// 3) actions should be chain-able (they should return the block object). Here they will be executed immediately
block.moveTo([x, y, 0]).rotateBy(45.0);
// 4) you can chain several actions in a sequence: this will move to x, y and *then* rotate by 90 degrees
block.moveTo([x, y, 0], 2.0).rotateBy(90.0, 2.0);
// 5) or be executed in parallel
block.spawnActions().moveTo([x, y, 0], 2.0).rotateBy(90.0, 2.0).spawnActions();
```

The only one that doesn't look good to me is number 6. Perhaps passing an of action names and arguments might be a better idea, something like:

```javascript
// 5b) parallel execution of actions
block.spawnActions([["moveTo", [x, y, 0], 2.0], ["rotateBy", 90.0, 2.0]]);
```

but that doesn't seems so clean either... Perhaps I should just follow the jquery way to execute actions...