fix beat warmup
This commit is contained in:
@@ -12,7 +12,6 @@ const SIGN_MATERIAL = {shader: 'flat', color: '#88f'};
|
||||
*/
|
||||
AFRAME.registerComponent('beat', {
|
||||
schema: {
|
||||
warmupPosition: {default: 0},
|
||||
anticipationPosition: {default: 0},
|
||||
color: {default: 'red', oneOf: ['red', 'blue']},
|
||||
cutDirection: {default: 'down'},
|
||||
@@ -21,7 +20,8 @@ AFRAME.registerComponent('beat', {
|
||||
size: {default: 0.35},
|
||||
speed: {default: 1.0},
|
||||
type: {default: 'arrow', oneOf: ['arrow', 'dot', 'mine']},
|
||||
verticalPosition: {default: 'middle', oneOf: ['bottom', 'middle', 'top']}
|
||||
verticalPosition: {default: 'middle', oneOf: ['bottom', 'middle', 'top']},
|
||||
warmupPosition: {default: 0},
|
||||
},
|
||||
|
||||
materialColor: {
|
||||
@@ -174,11 +174,11 @@ AFRAME.registerComponent('beat', {
|
||||
if (position.z < data.anticipationPosition) {
|
||||
let newPositionZ = position.z + BEAT_WARMUP_SPEED * (timeDelta / 1000);
|
||||
// Warm up / warp in.
|
||||
if (newPositionZ < data.warmupPosition) {
|
||||
this.beams.newBeam(this.data.color, position);
|
||||
if (newPositionZ < data.anticipationPosition) {
|
||||
position.z = newPositionZ;
|
||||
} else {
|
||||
position.z = data.anticipationPosition;
|
||||
this.beams.newBeam(this.data.color, position);
|
||||
}
|
||||
} else {
|
||||
// Standard moving.
|
||||
|
||||
@@ -75,7 +75,14 @@ AFRAME.registerComponent('stage-colors', {
|
||||
const red = color === 'red';
|
||||
|
||||
// Init or reset.
|
||||
this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
try {
|
||||
this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
} catch (e) {
|
||||
this.backglow.addEventListener('object3dset', () => {
|
||||
this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
});
|
||||
}
|
||||
|
||||
this.sky.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
this.el.sceneEl.object3D.background.set(red ? '#770100' : '#15252d');
|
||||
this.el.sceneEl.object3D.fog.color.set(red ? '#a00' : '#007cb9');
|
||||
|
||||
Reference in New Issue
Block a user