]> git.r.bdr.sh - rbdr/lissajous/blobdiff - lib/systems/lissajous_position_updater.js
Update mobile CSS
[rbdr/lissajous] / lib / systems / lissajous_position_updater.js
index 0f5792dffd26dcae307cb48d0b9e6d4ecd8c3689..39b151ac85d250ead87eaf6356f6b6869944b71a 100644 (file)
@@ -2,7 +2,7 @@ import { System } from '@serpentity/serpentity';
 import LissajousCurve from '../nodes/lissajous_curve';
 
 const internals = {
-  kAmplitude: 0.8,
+  kAmplitude: 1,
   kPeriod: Math.PI * 12000000
 };
 
@@ -21,20 +21,19 @@ export default class WebGLRenderer extends System {
 
   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) {