Added particle system example.

This commit is contained in:
codeanticode
2011-12-14 21:19:44 +00:00
parent 7a0ef2aaeb
commit 0c14337e67

View File

@@ -0,0 +1,27 @@
PShape system;
void setup() {
size(500, 500, P3D);
system = createShape(PShape.GROUP);
for (int i = 0; i < 10; i++) {
PShape pt = createShape(POINT);
pt.strokeWeight(20);
pt.stroke(random(255), random(255), random(255));
pt.vertex(random(width), random(height));
system.addShape(pt);
pt.end();
}
}
public void draw () {
background(255);
shape(system);
for (int i = 0; i < system.getChildCount(); i++) {
PShape pt = system.getChild(i);
pt.translate(random(-5, 5), random(-5, 5), random(-5, 5));
}
}