|
Author |
Topic: First tryouts (Read 478 times) |
|
Wim_Van_der_Vurst
|
First tryouts
« on: Oct 17th, 2002, 3:31pm » |
|
Hi, though i haven't got any previous experience in programming and therefore the examples aren't that innovating, i'm posting them anyway... Maybe somebody can use them anyway // Example box // by Wim Van der Vurst // A sort of 3D experience int a = 20; void setup() { size(200,200); background(255,50,50); rectMode(CENTER_DIAMETER); noStroke(); } void loop() { noFill(); rect(mouseX, mouseY, a, a); fill(100,100,100); quad(0, 0, mouseX-a/2, mouseY-a/2, mouseX-a/2, mouseY+a/2, 0, height); fill(150,150,150); quad(0, 0, mouseX-a/2, mouseY-a/2, mouseX+a/2, mouseY-a/2, width, 0); fill(200,200,200); quad(width, 0, mouseX+a/2, mouseY-a/2, mouseX+a/2, mouseY+a/2, width, height); fill(240,240,240); quad(width, height, mouseX+a/2, mouseY+a/2, mouseX-a/2, mouseY+a/2, 0, height); if (mousePressed) { a++; } else if (a>20) { a--; } }
|
|
|
|
Wim_Van_der_Vurst
|
First tryouts n°2
« Reply #1 on: Oct 17th, 2002, 3:34pm » |
|
I tried to make two moving rectangles but had problems with the fill command, so i faked it with the background color command... // Moving a line variation // by Wim Van der Vurst // based on moving line by REAS // changing colours float a = 0; int d=1; void setup() { size(200, 200); int r = int(random(255)); int g = int(random(255)); int b = int(random(255)); fill (r,g,b); background(r+20,g+20,b+20); } void loop() { if (a > height) { d = -1; int r = int(random(255)); int g = int(random(255)); int b = int(random(255)); fill (r,g,b); background(r+20,g+20,b+20); } if (a < 0) { d = +1; int r = int(random(255)); int g = int(random(255)); int b = int(random(255)); fill (r,g,b); background(r+20,g+20,b+20); } a=a+d; rect (0,0,width,a); stroke(255); line(0, a, width, a); }
|
|
|
|
Wim_Van_der_Vurst
|
First tryouts n°3
« Reply #2 on: Oct 17th, 2002, 3:36pm » |
|
Moving a 600x200 pixels image in a 200x200 frame //Image move //by Wim Van der Vurst int i = 0; int direction = 1; BImage a; // declare variable "a" of type BImage void setup() { size(200,200); a = loadImage("forest.gif"); } void loop() { if (i > 200) { direction = -1; } if (i<-200) { direction = +1; } i=i+direction; image (a,-200+i,0); }
|
|
|
|
Processing
|
Re: First tryouts
« Reply #3 on: Oct 17th, 2002, 5:16pm » |
|
Thank you for posting your examples, Wim. I think they are elegant.
|
|
|
|
|