|
Author |
Topic: push() and Pop() example (Read 508 times) |
|
chris
|
push() and Pop() example
« on: Dec 5th, 2002, 3:51pm » |
|
// Example POP // by Chris Noessel and Casey Reas // Using pop() and push() and mid-forloop modifications int xgridcount = 4; int ygridcount = 4; int zgridcount = 4; // -------------------- int halfx = xgridcount / 2; int halfy = ygridcount / 2; int halfz = zgridcount / 2; float a = 0.0; int gDistance = 200; float boxsize = 0; void setup() { size(400, 400); background(80); noStroke(); colorMode(HSB,100); } void loop() { translate(halfx*gDistance -gDistance, halfy*gDistance -gDistance,-gDistance *10); a += abs(sin(millis()/1500)/500); // first number is pauses between //timechange, lower 2nd number = faster speed push(); for(int i=halfx *-1; i<=halfx; i+=1) { translate(gDistance, 0, 0); rotateX(a*.9); push(); for(int j=halfy *-1; j<= halfy; j+=1){ translate(-width/2, gDistance, 0); rotateZ(a*1.1); push(); for(int k=halfz * -1; k<= halfz; k+=1){ translate(0, 0, gDistance); rotateY(a); boxsize = 30 + (sin(i*j*k*a) *(gDistance)*1.66); fill(0, 0, 100-boxsize/5.1); box(boxsize, boxsize, boxsize); } pop(); } pop(); } pop(); }
|
« Last Edit: Dec 6th, 2002, 10:27am by chris » |
|
You are something the universe is doing
|
|
|
|