summaryrefslogtreecommitdiff
path: root/src/relabi/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/relabi/index.js')
-rw-r--r--src/relabi/index.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/relabi/index.js b/src/relabi/index.js
index 89e4ce9..8e23d2a 100644
--- a/src/relabi/index.js
+++ b/src/relabi/index.js
@@ -10,7 +10,7 @@ const TWO_PI = 2 * Math.PI;
/**
* Wave functions
*/
-const WAVE_FUNCTIONS = {
+const WAVE_SHAPES = {
sine: Math.cos,
triangle: (time) =>
(4 / TWO_PI) *
@@ -33,10 +33,10 @@ export default class Relabi {
this.updateTime = 1;
this.steps = 50;
this.waves = waves || [
- { type: "triangle", frequency: randrange(0.5, 1.5) },
- { type: "triangle", frequency: randrange(0.75, 2.25) },
- { type: "triangle", frequency: randrange(1, 3) },
- { type: "triangle", frequency: randrange(2, 4) },
+ { shape: "triangle", frequency: randrange(0.5, 1.5) },
+ { shape: "triangle", frequency: randrange(0.75, 2.25) },
+ { shape: "triangle", frequency: randrange(1, 3) },
+ { shape: "triangle", frequency: randrange(2, 4) },
];
this.bounds = bounds;
this.previousValue = null;
@@ -91,7 +91,7 @@ export default class Relabi {
// Compute the wave functions for this event
for (index = 0; index < waveCount; index += 1) {
const wave = this.waves[index];
- value += WAVE_FUNCTIONS[wave.type](timeOffset * wave.frequency);
+ value += WAVE_SHAPES[wave.shape](timeOffset * wave.frequency);
}
// Scale to [-1, 1]