});
- yuu.Animation = yT(yuu.C, {
+ var animationOps = [];
+
+ var Animation = yuu.Animation = yT(yuu.C, {
constructor: function (timeline, params, completionHandler, delay) {
this.timeline = yf.mapValues(yf.arrayify, timeline);
this.params = params;
this.tweenAll(instr.tweenAll, instr);
if (instr.event)
this.event(instr.event);
+ animationOps.forEach(function (f) {
+ if (instr[f.name])
+ f.call(this, instr[f.name], instr);
+ }, this);
},
tick: function () {
TAPS: ["tick", "tock"]
});
+ Animation.registerOperation = function (f) {
+ animationOps.push(f);
+ };
+
yuu.Tween = yT({
/** Tween object properties over time
var director = yuu.director = new yuu.Director();
/** The standard director */
+ if (yuu.audio) {
+ yuu.Animation.registerOperation(function playSound (sound) {
+ if (Array.isArray(sound))
+ sound = yuu.random.choice(sound);
+ (new yuu.Instrument(sound)).play();
+ });
+ }
+
yuu.registerInitHook(function () {
return yuu.ready(director._scenes);
});