20100920

Processing: Assignment 1


This is my really really abstracted rendering of a Canon AE-1.

In time I will wow the world with my processing skillz. In time.
















SOURCE CODE:

size(600, 800);
background(2);
smooth();

//begin code for triangle strip (lens)
int x = width/2;
int y = height/2;
float outerRad = min(200, 200) * 0.4;
float innerRad = outerRad * 0.6;
float px = 0, py = 0, angle = 0;
float pts = 36;
float rot = 360.0/pts;

beginShape(TRIANGLE_STRIP);
for (int i = 0; i < pts; i++) { px = x + cos(radians(angle))*outerRad; py = y + sin(radians(angle))*outerRad; angle += rot; vertex(px, py); px = x + cos(radians(angle))*innerRad; py = y + sin(radians(angle))*innerRad; vertex(px, py); angle += rot; } endShape(); //begin code for points and lines (frame) int d = 200; int p1 = d; int p2 = p1+d; int p3 = p2+d; int p4 = p3+d; size(600, 800); background(0); // Draw gray box stroke(153); line(p3, p3, p2, p3); line(p2, p3, p2, p2); line(p2, p2, p3, p2); line(p3, p2, p3, p3); beginShape(TRIANGLE_STRIP); for (int i = 0; i < pts; i++) { px = x + cos(radians(angle))*outerRad; py = y + sin(radians(angle))*outerRad; angle += rot; vertex(px, py); px = x + cos(radians(angle))*innerRad; py = y + sin(radians(angle))*innerRad; vertex(px, py); angle += rot; } endShape(); //code for shape primitive (flash) smooth(); noStroke(); fill(226); rect(45, 45, 35, 35); smooth(); noStroke(); fill(226); rect(200, 400, 35, 35);

Built with Processing

No comments:

About Me

My photo
ITP Master's Candidate at Tisch School of the Arts. Interactivity enthusiast. Cat lover.