We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › my first little project in processing
Page Index Toggle Pages: 1
my first little project in processing (Read 457 times)
my first little project in processing
Feb 5th, 2010, 11:14am
 
hello there,


with this little sketch (inspired by "generative gestaltung")
i figured out for myself how to handle
a rotation in 3D and to work with random.
(order vs. disorder)

i did this to learn processing and to get used to the programing-language.
two other projects/lessons will follow soon.

put the code in your editor and push the play button.
i think, it's self explaining...

cheers
ingo


Code:


int actRandomSeed = 0;
int count = 19;

void setup() {

size(600, 600, P3D);
cursor(CROSS);
background(255);
smooth();
stroke(255);

}

void draw() {

background(0);
noFill();
stroke(255);
strokeWeight(0.5);


translate(width / 2, height / 2);

float faderX = (float)mouseX/width;
float faderY = (float)mouseY/height;

rotateX (lerp(0, PI, faderY));

randomSeed(actRandomSeed);

for (int i=0; i<count; i++){

float structureX = 0;
float structureY = PI/count;
float structureZ = 0;

float chaosX = random(degrees(0.01));
float chaosY = random(degrees(0.01));
float chaosZ = random(degrees(0.01));


rotateX (lerp(structureX, chaosX, faderX));
rotateY (lerp(structureY, chaosY, faderX));
rotateZ (lerp(structureZ, chaosZ, faderX));


ellipse(0, 0, 400, 400);

}

}

void mouseReleased() {
actRandomSeed = (int) random(10);
}







Page Index Toggle Pages: 1