Files
junisaber/src/components/score-beat.js
Diego F. Goberna 7822c8ffcb supercut cleanups
2018-11-21 11:57:56 +01:00

20 lines
428 B
JavaScript

/**
* Score beat, auto-return to pool in 1.2s.
*/
AFRAME.registerComponent('score-beat', {
schema: {
type: { type: 'string' }
},
play: function () {
this.poolComponent = `pool__beatscore${this.data.type}`;
this.startTime = this.el.sceneEl.time;
},
tick: function (time) {
if (time > this.startTime + 1200) {
this.el.sceneEl.components[this.poolComponent].returnEntity(this.el);
}
}
});