It can even be interactive
Interactivity is pretty straightforward from here
becomes a lot more challenging if you move off the Z=0 plane
Example 6
|
PSystem ps;
Particle p1;
void setup() {
size(500,500);
ps = (PSystem)loadPlugin("PSystem");
p1 = new Particle();
p1.setPos(width / 2 - 10, height/2, 0);
p1.fix();
Particle p2 = new Particle();
p2.setPos(width / 2 + 10, height/2, 0);
ps.addParticle(p1);
ps.addParticle(p2);
ps.addSpring(p1, p2);
ps.setGravity(0.5);
}
void loop() {
background(#99CCCC);
p1.setPos(mouseX, mouseY, 0);
ps.draw();
}
|