sounds = {
tick: new yuu.Instrument("@tick"),
tock: new yuu.Instrument("@tock"),
- regear: new yuu.Instrument("@regear"),
- winding: new yuu.Instrument("@winding"),
- slam: new yuu.Instrument("@slam"),
switch: new yuu.Instrument("@switch"),
- clicking: new yuu.Instrument("@clicking"),
- bookAppear: new yuu.Instrument("@book-appear"),
switchBroke: new yuu.Instrument({
sample: { "@switch": { duration: 0.27, offset: 0.1 } } }),
switchOn: new yuu.Instrument({
return yuu.ready(
[SIGILS, BOOK]
+ .concat(yf.map(yf.new_(yuu.Instrument), [
+ '@winding', '@regear', '@clicking', '@slam', '@book-appear']))
.concat(yf.map(yf.getter.bind(sounds), Object.keys(sounds)))
);
}
});
var SLAMMER_ROTATE = {
- 0: { tween1: { yaw: "yaw" }, duration: 10 }
+ 0: { tween1: { yaw: "yaw" },
+ playSound: "@clicking",
+ duration: 10 }
};
var ROTATE_ALL = {
};
var SLAMMER_SLAM = {
- 0: { tween1: { y: -1.5 }, easing: "linear", duration: 6 },
+ 0: { tween1: { y: -1.5 }, easing: "linear",
+ playSound: "@slam",
+ duration: 6 },
6: { event: "slideBoardBlocks" },
15: { event: "slam",
tween1: { y: 0 }, easing: "linear", duration: 8 }
var yaw0 = this.slammerRoot.transform.yaw;
var yaw1 = orientation * Math.PI / 2;
- sounds.clicking.play();
this.entity0.attach(new yuu.Animation(
SLAMMER_ROTATE, {
$: this.slammerRoot.transform,
}
this._locks.increment("spin", "slam");
circleScene.slam();
- sounds.slam.play();
handScene.slam(this.slammer.controller.orientation);
this.entity0.attach(new yuu.Animation(
SLAMMER_SLAM, {
};
var MENU_SLAM = {
- 0: { tween: { cursor: { y: "mid" } }, duration: 8 },
+ 0: { tween: { cursor: { y: "mid" } },
+ playSound: "@winding",
+ duration: 8 },
8: { tween: { cursor: { y: "line" },
select: { y: -1.0 }
}, duration: 12 },
handScene.menuChoice();
circleScene.toBack();
circleScene.slam();
- sounds.winding.play();
this.entity0.animationQueue.enqueue(
MENU_SLAM, {
cursor: this.pointer.transform,
var BOOK_APPEAR = {
0: { set1: { y: 1.5, x: -1.5 },
tween: { bgQuad: { alpha: 0.75 }, $: { y: 0, x: 0 }, },
+ playSound: "@book-appear",
duration: 30 }
};
var BOOK_DISMISS = {
0: { tween: { bgQuad: { alpha: 0 }, $: { y: 1.5, x: -1.5, } },
+ playSound: "@book-dismiss",
duration: 30 }
};
tween: { page1: { x: -1/3 / 2, scaleX: 0 },
page2: { x: +1/3 / 2 },
page2Quad: { color: [1, 1, 1, 1] },
- }, duration: 15, easing: "linear" },
+ }, duration: 15, easing: "linear",
+ playSound: ["@page-turn-1", "@page-turn-2", "@page-turn-3"]
+ },
15: { set: { page1Quad: { z: 0, texBounds: [0.25, 0.5, 0.00, 1] },
page2Quad: { z: 0, texBounds: "page" } },
tween: { page1: { x: -1/3, scaleX: -2/3 },
{ 0: { tween: { page1: { x: -1/3 / 2 },
page2: { x: +1/3 / 2, scaleX: 0 }
- }, duration: 15, easing: "linear" },
+ }, duration: 15, easing: "linear",
+ playSound: ["@page-turn-1", "@page-turn-2", "@page-turn-3"]
+ },
15: { set: { page1Quad: { z: 0, texBounds: [0.25, 0.5, 0.00, 1] },
page2Quad: { z: 1, texBounds: [1.00, 0.5, 0.75, 1] } },
tween: { page1Quad: { color: [0.2, 0.2, 0.2, 1] },
var BOOK_BACKWARD = [
{ 0: { tween: { page1: { x: -1/3 / 2, scaleX: 0 },
page2: { x: +1/3 / 2 },
- }, duration: 15, easing: "linear" },
+ }, duration: 15, easing: "linear",
+ playSound: ["@page-turn-1", "@page-turn-2", "@page-turn-3"]
+ },
15: { set: { page1Quad: { z: 1, texBounds: [0.50, 0.5, 0.75, 1] },
page2Quad: { z: 0 } },
tween: { page2Quad: { color: [0.2, 0.2, 0.2, 1] },
tween: { page1Quad: { color: [1.0, 1.0, 1.0, 1] },
page1: { x: -1/3 / 2 },
page2: { x: +1/3 / 2, scaleX: 0 }
- }, duration: 15, easing: "linear" },
+ }, duration: 15, easing: "linear",
+ playSound: ["@page-turn-1", "@page-turn-2", "@page-turn-3"]
+ },
15: { set: { page1Quad: { z: 0, texBounds: [0.25, 0.5, 0.00, 1] },
page2Quad: { z: 0, texBounds: "page" } },
this._locks = new FlagSet("turn");
this.addEntities(bg, this.page1, this.page2);
- this.dismissSound = new yuu.Instrument("@book-dismiss");
- this.pageSounds = [new yuu.Instrument("@page-turn-1"),
- new yuu.Instrument("@page-turn-2"),
- new yuu.Instrument("@page-turn-3")];
-
- this.ready = yuu.ready([this.dismissSound].concat(this.pageSounds));
+ this.ready = yuu.ready(yf.map(yf.new_(yuu.Instrument), [
+ "@page-turn-1", "@page-turn-2", "@page-turn-3",
+ "@book-dismiss"
+ ]));
},
help: yuu.cmd(function () {
_anim: function (anim) {
this._locks.increment("turn");
- // FIXME: Need hooks from animations to audio
var completion = this._locks.decrementer("turn");
switch (anim) {
case BOOK_DISMISS:
- this.dismissSound.play();
completion = yuu.director.removeScene.bind(yuu.director, this);
break;
- case BOOK_APPEAR:
- sounds.bookAppear.play();
- break;
- default:
- yuu.random.choice(this.pageSounds).play();
- break;
}
var device = yuu.director.preferredDevice();
};
var CIRCLE_INNER_RATCHET = {
- 0: { tween1: { rotation: "rotation1" }, duration: 15 },
+ 0: { tween1: { rotation: "rotation1" }, duration: 15,
+ playSound: "@regear"
+ },
10: { tween1: { rotation: "rotation2" }, duration: 10 },
20: { tween1: { rotation: "rotation1" }, duration: 20,
easing: yuu.Tween.STEPPED(5) },
rotation1: rot1,
rotation2: rot2
}));
- sounds.regear.play();
},
rotated: function () {