Add Walls

This commit is contained in:
Diego Marcos
2018-10-11 22:15:41 -10:00
parent 8159e18bcb
commit 65cb45590f
4 changed files with 108 additions and 19 deletions

View File

@@ -136,7 +136,7 @@ AFRAME.registerComponent('beat-loader', {
for (i=0; i < obstacles.length; ++i) {
noteTime = obstacles[i]._time * msPerBeat;
if (noteTime > beatsTime && noteTime <= beatsTime + delta) {
//this.generateWall(obstacles[i]);
this.generateWall(obstacles[i]);
}
}
@@ -188,23 +188,23 @@ AFRAME.registerComponent('beat-loader', {
};
})(),
// generateWall: function (wallInfo) {
// var el = this.el.sceneEl.components.pool__wall.requestEntity();
// var speed = this.data.beatSpeed;
// var durationMs;
// if (!el) { return; }
// durationSeconds = 60 * (wallInfo._duration / this.bpm);
// el.setAttribute('wall', {
// speed: speed
// });
// el.object3D.position.set(
// this.horizontalPositions[wallInfo._lineIndex],
// 1.30,
// -(this.data.beatAnticipationTime * speed)
// );
// el.object3D.scale.set(wallInfo._width * 0.30, 2.5, durationSeconds * speed);
// el.play();
// },
generateWall: function (wallInfo) {
var el = this.el.sceneEl.components.pool__wall.requestEntity();
var speed = this.data.beatSpeed;
var durationMs;
if (!el) { return; }
durationSeconds = 60 * (wallInfo._duration / this.bpm);
el.setAttribute('wall', {
speed: speed
});
el.object3D.position.set(
this.horizontalPositions[wallInfo._lineIndex],
1.30,
-(this.data.beatAnticipationTime * speed)
);
el.object3D.scale.set(wallInfo._width * 0.30, 2.5, durationSeconds * speed);
el.play();
},
requestBeat: function (type, color) {
var beatPoolName = 'pool__beat-' + type;