kPeriod: Math.PI * 12000000
};
+/**
+ * Calculates the lissajous curve over time
+ * NOTE: This shouldn't store data, I should have a different entity for
+ * the actual drawable vertices. Either put the storage in the curve, or
+ * create a separate entity.
+ */
export default class WebGLRenderer extends System {
constructor() {
this.time = (this.time + dt / 500) % internals.kPeriod;
for (const curve of this.curves) {
- 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);
+ curve.position.x = this._getPosition(curve.amplitude.a, curve.frequency.a, this.time, curve.phase.a);
+ curve.position.y = this._getPosition(curve.amplitude.b, curve.frequency.b, this.time, curve.phase.b);
+ curve.position.z = this._getPosition(curve.amplitude.c, curve.frequency.c, this.time, curve.phase.c);
}
}