Successfully reported this slideshow.
Upcoming SlideShare
×

Proga 0601

1,079 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Proga 0601

1. 1. y x z
2. 2. float rot=0; void setup(){ size(400,400); colorMode(HSB,360,100,100,100); frameRate(30); smooth(); fill(200,100,100); stroke(0,0,100); rectMode(CENTER); } void draw(){ background(0,0,20); translate(width/2,height/2); rotate(rot); rect(0,0,200,200); rot += 0.1; }
3. 3. import processing.opengl.*; float rot=0; void setup(){ size(400,400,OPENGL); colorMode(HSB,360,100,100,100); frameRate(30); fill(200,100,100); stroke(0,0,100); rectMode(CENTER); } void draw(){ background(0,0,20); translate(width/2,height/2); rotateX(rot); rect(0,0,200,200); rot += 0.1; }
4. 4. import processing.opengl.*; float rotX=0, rotY=0, rotZ=0; void setup(){ size(400,400,OPENGL); colorMode(HSB,360,100,100,100); frameRate(30); fill(200,100,100); stroke(0,0,100); rectMode(CENTER); } void draw(){ background(0,0,20); translate(width/2,height/2); rotateX(rotX); rotateY(rotY); rotateZ(rotZ); rect(0,0,200,200); rotX += 0.1; rotY += 0.2; rotZ += 0.3; }
5. 5. import processing.opengl.*; int NUM = 5000; float[] x = new float[NUM]; float[] y = new float[NUM]; float[] z = new float[NUM]; color[] col = new color[NUM]; void setup(){ size(400,400,OPENGL); colorMode(HSB,360,100,100,100); frameRate(30); noFill(); stroke(200,100,100); smooth(); for(int i=0; i<NUM; i++){ x[i] = random(width); y[i] = random(height); z[i] = random(-5000,0); col[i] = color(random(200,240),random(50,100),random(100)); } }
6. 6. void draw(){ background(0); for(int i=0; i<NUM; i++){ stroke(color(col[i])); line(x[i],y[i],z[i],x[i],y[i],z[i]+100); z[i]+=20; if(z[i]>100){ z[i] -= 5000; } } }
7. 7. import processing.opengl.*; int NUM = 100; float[] x = new float[NUM]; float[] y = new float[NUM]; float[] z = new float[NUM]; float[] rot = new float[NUM]; float[] rSpeed = new float[NUM]; color[] col = new color[NUM]; void setup(){ size(400,400,OPENGL); colorMode(HSB,360,100,100,100); frameRate(30); noStroke(); smooth(); for(int i=0; i<NUM; i++){ x[i] = random(width); y[i] = random(height); z[i] = random(-5000,0); rot[i] = 0; rSpeed[i] = random(-0.1,0.1); col[i] = color(random(0,360),random(100),random(100),50); } }
8. 8. void draw(){ background(0); for(int i=0; i<NUM; i++){ fill(color(col[i])); pushMatrix(); translate(x[i],y[i],z[i]); rotateX(rot[i]); rotateY(rot[i]); rotateZ(rot[i]); box(30); popMatrix(); z[i]+=20; rot[i] += rSpeed[i]; if(z[i]>100){ z[i] -= 5000; } } }
9. 9. import processing.opengl.*; float a; int NUM = 128; float offset = PI/NUM; color[] colors = new color[NUM]; void setup() { size(400, 400, OPENGL); noStroke(); colorMode(HSB,360,100,100,100); frameRate(30); for(int i=0; i<NUM; i++) { colors[i] = color(i*2+100,70,100,25); } lights(); }
10. 10. void draw() { background(0); lights(); translate(width/2, height/2, -20); a+=0.01; for(int i=0; i<NUM; i++) { pushMatrix(); fill(colors[i]); rotateY(a+offset*i); rotateX(a/2+offset*i); rotateZ(a/3+offset*i); box(width/2); popMatrix(); } }