Animatron/player — pull request #56 by shamansir (2012-10-26 17:40:52+00:00)
Title: Time restricted modifiers

**NB** _Not to mess something while I am in hurry, I will merge and add comments/tag to this PR at Monday (29) or through holidays by myself, please do not merge it before_

Introduces new types of modifiers:

* `b().modify(function(t) { ... })`, acts like before
* `b().modify([x, y], function(t) { ... })`, will call a modifier through the inner band, getting _value from `0..1`_ in the duration of the band `[x, y]`, like tweens. It is important to note that it will get `0` all the time before `x` and `1` all the time after `y`, please consider that when using this type of modifiers (see example below). Tweens are supposed to act identically to this way, soon.
* `b().modify(my_t, function(t) { ... })` will call a modifier at `my_t` time or a bit later, if framerate is low, and will get actual time when it was called. both `my_t` and `t` are relative to a band of the element. It is now used instead of `b().at()` method which in its order calls this method to keep player be back-compatible in this version.

New versions will come soon (where `t ` will be in range `0..1` for all of modifiers and modifiers will get duration of an element or theirs band)

Also includes:

* a lot of changes and improvements for tests
* tests for all of the given logic
* removed preview for modes other than `C.M_VIDEO` mode

I've made this version safe not to affect tweens, it will be the next PR (Monday, I think).

This version will have a tag `v0.245`, while previous version will have a tag `v0.24`. A version where all modifiers get `0..1` value is planned to have a tag `v0.246` or something like that.

Tests fail at TeamCity, but run ok locally, you may ensure in it with `tests/run-for-teamcity.html`. I will fix it later.

A small example:

```javascript
return b().add(b().rect([80, 80], 80)
.modify([1, 1.5], function(t) {
b(this.$).fill(B.rgb(255 * t, 0, 0));
b(this.$).stroke(B.rgb(255 - (t * 255), 0 ,0),
20 * t)
}))
.add(b().circle([120, 120], 30)
.modify(0.5, function(t) {
b(this.$).fill('yellow'); })
.modify(1.5, function(t) {
b(this.$).fill('cyan'); }));
```