You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
699 B
32 lines
699 B
2 years ago
|
class Manager {
|
||
|
|
||
|
nPendula: NPendulum[] = []
|
||
|
|
||
|
h = 0.07
|
||
|
|
||
|
constructor() {
|
||
|
p.colorMode(p.HSB, 100);
|
||
|
let count = 500;
|
||
|
for (let i = 0; i < count; i++){
|
||
|
let rad = i / count / 1e3 + p.PI * 1.05;
|
||
|
let hue = i / count * 100;
|
||
|
let color = p.color(hue, 100, 100);
|
||
|
this.nPendula.push(
|
||
|
new NPendulum([200, 200], [2, 2], rad, color)
|
||
|
);
|
||
|
}
|
||
|
p.colorMode(p.RGB);
|
||
|
}
|
||
|
|
||
|
update(){
|
||
|
this.nPendula.forEach(p => p.update(this.h));
|
||
|
}
|
||
|
|
||
|
draw(){
|
||
|
p.push()
|
||
|
p.translate(p.width / 2, p.height / 2);
|
||
|
this.nPendula.forEach(p => p.draw());
|
||
|
p.pop();
|
||
|
}
|
||
|
|
||
|
}
|