Files
sunny9898/task8/_ref/flow_field-main/flow_field.pde
louiscklaw 5637fbf94f update,
2025-02-01 02:07:58 +08:00

28 lines
719 B
Plaintext

ArrayList<Particle> particles = new ArrayList<Particle>();
Field flowField;
int particleCount = 10000;
color backgroundColor = color(255);
void setup() {
size(1200, 800);
frameRate(60);
background(backgroundColor);
flowField = new Field(new PVector(0, 0), 100, 8, .3);
for(int i=0;i<particleCount;i++) {
particles.add(new Particle(new PVector(random(width), random(height))));
}
}
void draw() {
for(Particle p : particles) {
p.update();
}
flowField.updateZ(0.01);
}
void mousePressed() {
background(backgroundColor);
noiseSeed(int(random(100000)));
for(Particle p : particles) {
p.location = new PVector(random(width), random(height));
}
}