import LissajousCurve from '../nodes/lissajous_curve';
const internals = {
- kAmplitude: 0.8,
+ kAmplitude: 1,
kPeriod: Math.PI * 12000000
};
removed(){
- this.curves = undefined;
- this.time = undefined;
+ delete this.curves;
+ delete this.time;
}
update(dt){
- this.time = (this.time + dt / 100) % internals.kPeriod;
+ this.time = (this.time + dt / 500) % internals.kPeriod;
for (const curve of this.curves) {
- curve.position.x = this._getPosition(internals.kAmplitude, curve.frequency.a, this.time, 0);
- curve.position.y = this._getPosition(internals.kAmplitude, curve.frequency.b, this.time, 0);
- curve.position.z = this._getPosition(internals.kAmplitude, curve.frequency.c, this.time, 0);
+ curve.position.x = this._getPosition(curve.amplitude.a, curve.frequency.a, this.time, 0);
+ curve.position.y = this._getPosition(curve.amplitude.b, curve.frequency.b, this.time, 0);
+ curve.position.z = this._getPosition(curve.amplitude.c, curve.frequency.c, this.time, 0);
}
- console.log('UP');
}
_getPosition(amplitude, frequency, time, phaseShift) {