beam effect on new blocks

This commit is contained in:
Diego F. Goberna
2018-10-03 02:30:51 +02:00
parent fde9ad8a59
commit 1230fe44ef
6 changed files with 77 additions and 6 deletions

View File

@@ -15,6 +15,10 @@ AFRAME.registerComponent('beat-loader', {
horizontalPositions: [-0.60, -0.25, 0.25, 0.60],
verticalPositions: [1.00, 1.35, 1.70],
init: function () {
this.beams = document.getElementById('beams').components['beams'];
},
update: function () {
if (!this.data.challengeId || !this.data.difficulty) { return; }
this.loadBeats();
@@ -122,6 +126,8 @@ AFRAME.registerComponent('beat-loader', {
el.object3D.rotation.z = THREE.Math.degToRad(this.orientations[noteInfo._cutDirection]);
el.play();
this.beams.newBeam(color, el.object3D.position);
if (this.first) { return; }
this.first = {