wavegroup.js
839 Bytes
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
import{
Wave
} from './wave.js'
export class WaveGroup {
constructor(){
this.totalWaves = 3;
this.totalPoints = 6;
this.color = ['rgba(255,199,235,0.4)','rgba(255,146,199,0.4)','rgba(0,87,158,0.4)'];
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);
}
}
}