-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwavegroup.js
38 lines (29 loc) · 863 Bytes
/
wavegroup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Wave } from './wave.js';
export class WaveGroup {
constructor() {
this.totalWaves = 3;
this.totalPoints = 5;
this.color = ['rgba(66, 135, 245, 0.25)', 'rgba(72, 206, 240, 0.25)', 'rgba(87, 30, 201, 0.25)'];
this.waves = [];
for (let i = 0; i < this.totalWaves; i++) {
const wave = new Wave(
i,
this.totalPoints,
this.color[i],
);
this.waves[i] = wave;
}
}
resize(stageWidth, stageHeight) {
for (let i = 0; i < this.totalWaves; i++) {
const wave = this.waves[i];
wave.resize(stageWidth, stageHeight);
}
}
draw(ctx) {
for (let i = 0; i < this.totalWaves; i++) {
const wave = this.waves[i];
wave.draw(ctx);
}
}
}