Your SlideShare is downloading. ×
0
void setup() {
  size(400, 400);
  background(0);
  colorMode(HSB,360,100,100);
  stroke(0,0,100);
  fill(200,100,100);
}
...
RectDrawer r = new RectDrawer();

void setup() {
  size(400, 400);
  background(0);
  colorMode(HSB,360,100,100);
  stroke...
RectDrawer r1;
RectDrawer r2;

void setup() {
  size(400, 400);
  colorMode(HSB,360,100,100);
  stroke(0,0,100);
  fill(20...
class RectDrawer {
  float x, y, rectSize;

    RectDrawer(float x, float y, float rectSize){
      this.x = x;
      this...
class Car {

 color   c;
 float   xpos;
 float   ypos;
 float   xvel;

 Car(color c, float xpos, float ypos, float xvel) {...
void drive () {
      xpos = xpos + xvel;
      if (xpos > width) {
        xpos = -20;
      }
    }
}
Car myCar1;
Car myCar2;

void setup() {
	   size(400,400);
	   frameRate(30);
	   colorMode(HSB,360,100,100);
	   myCar1 =...
class Car {

	   color   c;
	   float   xpos;
	   float   ypos;
	   float   xvel;

	   Car(color c, float xpos, float ypos...
void drive () {
	   	 xpos = xpos + xvel;
	   	 if (xpos > width) {
	   	 	    xpos = -20;
	   	 }
	   }
}
int MAX = 100;
Car[] myCars = new Car[MAX];

void setup() {
  size(400,400);
  frameRate(30);
  noStroke();
  colorMode(HS...
void draw() {
  background(0);
  for (int i = 0; i < MAX; i++) {
    myCars[i].drive();
    myCars[i].draw();
  }
}
class Car {
	
	   color c;
	   float xpos;
	   float ypos;
	   float xvel;
	
	   Car(color c, float xpos, float ypos, floa...
void drive () {
	   	 xpos = xpos + xvel;
	   	 if (xpos > width) {
	   	 	    xpos = -20;
	   	 }
	   }
}
xn+1 = sin(ayn) - cos(axn)
yn+1 = sin(bxn) - cos(byn)
int num = 3000;
float[] a = new float[4];
float drawScale = 0.2;
float range = 2.5;
boolean drawing = false;
Attr[] attr =...
void draw(){
	   for(int i=0;i<num;i++){
	   	 attr[i].update();
	   }
}

void mouseReleased(){
	   if(!drawing){
	   	 ne...
void newDraw(){
	   background(0);
	   initParam();
	   for(int i=0;i<num;i++){
	   	 attr[i]=new Attr();
	   }
}
void ini...
class Attr {
	   float nx,ny,ox,oy;
	   color myc;
	   Attr(){
	   	 ox =random(-2.0,2.0);
	   	 oy =random(-2.0,2.0);
	  ...
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Proga 0608
Upcoming SlideShare
Loading in...5
×

Proga 0608

930

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
930
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide









































  • Transcript of "Proga 0608"

    1. 1. void setup() { size(400, 400); background(0); colorMode(HSB,360,100,100); stroke(0,0,100); fill(200,100,100); } void draw() { rectMode(CENTER); rect(width/2,height/2,200,200); }
    2. 2. RectDrawer r = new RectDrawer(); void setup() { size(400, 400); background(0); colorMode(HSB,360,100,100); stroke(0,0,100); fill(200,100,100); rectMode(CENTER); } void draw() { r.drawRect(); } class RectDrawer { void drawRect() { rect(width/2,height/2,200,200); } }
    3. 3. RectDrawer r1; RectDrawer r2; void setup() { size(400, 400); colorMode(HSB,360,100,100); stroke(0,0,100); fill(200,100,100); rectMode(CENTER); } void draw() { background(0); r1 = new RectDrawer(200,200,200); r2 = new RectDrawer(110,260,150); r1.drawRect(); r2.drawRect(); }
    4. 4. class RectDrawer { float x, y, rectSize; RectDrawer(float x, float y, float rectSize){ this.x = x; this.y = y; this.rectSize = rectSize; } void drawRect() { rect(x,y,rectSize,rectSize); } }
    5. 5. class Car { color c; float xpos; float ypos; float xvel; Car(color c, float xpos, float ypos, float xvel) { this.c = c; this.xpos = xpos; this.ypos = ypos; this.xvel = xvel; } void draw () { fill(c); rect(xpos,ypos,20,10); }
    6. 6. void drive () { xpos = xpos + xvel; if (xpos > width) { xpos = -20; } } }
    7. 7. Car myCar1; Car myCar2; void setup() { size(400,400); frameRate(30); colorMode(HSB,360,100,100); myCar1 = new Car(color(200,100,100),0,150,1); myCar2 = new Car(color(0,100,100),0,250,2); } void draw() { background(0); myCar1.draw(); myCar2.draw(); myCar1.drive(); myCar2.drive(); }
    8. 8. class Car { color c; float xpos; float ypos; float xvel; Car(color c, float xpos, float ypos, float xvel) { this.c = c; this.xpos = xpos; this.ypos = ypos; this.xvel = xvel; } void draw () { fill(c); rect(xpos,ypos,20,10); }
    9. 9. void drive () { xpos = xpos + xvel; if (xpos > width) { xpos = -20; } } }
    10. 10. int MAX = 100; Car[] myCars = new Car[MAX]; void setup() { size(400,400); frameRate(30); noStroke(); colorMode(HSB,360,100,100); for (int i = 0; i < MAX; i++) { color tempcolor = color(random(360),random(50,100),random(50,100)); myCars[i] = new Car(tempcolor,random(width),random(height),random(1,5)); } }
    11. 11. void draw() { background(0); for (int i = 0; i < MAX; i++) { myCars[i].drive(); myCars[i].draw(); } }
    12. 12. class Car { color c; float xpos; float ypos; float xvel; Car(color c, float xpos, float ypos, float xvel) { this.c = c; this.xpos = xpos; this.ypos = ypos; this.xvel = xvel; } void draw () { fill(c); rect(xpos,ypos,20,10); }
    13. 13. void drive () { xpos = xpos + xvel; if (xpos > width) { xpos = -20; } } }
    14. 14. xn+1 = sin(ayn) - cos(axn) yn+1 = sin(bxn) - cos(byn)
    15. 15. int num = 3000; float[] a = new float[4]; float drawScale = 0.2; float range = 2.5; boolean drawing = false; Attr[] attr = new Attr[num]; void setup(){ size(640,640); background(0); fill(255,255,255,40); noStroke(); smooth(); framerate(30); newDraw(); drawing = true; }
    16. 16. void draw(){ for(int i=0;i<num;i++){ attr[i].update(); } } void mouseReleased(){ if(!drawing){ newDraw(); drawing = true; loop(); } else { noLoop(); drawing = false; } }
    17. 17. void newDraw(){ background(0); initParam(); for(int i=0;i<num;i++){ attr[i]=new Attr(); } } void initParam(){ a[0] =random(0,3.0); a[1] =random(0,3.0); a[2] =random(0,3.0); a[3] =random(0,3.0); }
    18. 18. class Attr { float nx,ny,ox,oy; color myc; Attr(){ ox =random(-2.0,2.0); oy =random(-2.0,2.0); } void update(){ nx = sin(a[0]*oy)-cos(a[1]*ox); ny = sin(a[2]*ox)-cos(a[3]*oy); ellipse(nx*width*drawScale+width/2, ny*height*drawScale +height/2, 0.3, 0.3); ox=nx; oy=ny; } }
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×