Code
float R,G,B;
void loop() {
background(150,150,230);
// i can draw points :)
strokeWeight(1);
for (int i=80; i<350; i+=2) {
stroke(i/300.0*255.0);
point(i,i);
}
// i can draw lines :)
strokeWeight(1);
for (int i=0; i<400; i+=10) {
stroke(i/400.0*255.0);
line(0,i,i,400);
}
// i can draw rectangles :)
noStroke();
float rectLength;
for (int i=0; i<=400; i+=20) {
rectLength = 400-sqrt(sq(400.0)-sq(i));
R = 100+(i/400.0*80.0);
G = R;
B = 255;
fill(R,G,B);
rect(400.0-rectLength, 400-i, rectLength, 10);
}
// i can draw ellipses :)
ellipseMode(CENTER_DIAMETER);
noStroke();
for (int i=0; i<400; i+=50) {
R = 230;
G = 100+(i/400.0*80.0);
B = G;
fill(R,G,B,i/400.0*100.0);
ellipse((400-i), sqrt(sq(400.0)-sq(i)), i/4, i/4);
ellipse(sqrt(sq(400.0)-sq(i)), (400-i), i/4, i/4);
}
// no more recursions :P
push();
translate(0,0,10.0*sin(TWO_PI*(millis() % 2000)/2000.0));
// i can draw quadrilaterals & triangles
noFill();
stroke(255);
strokeWeight(1);
quad(100,50,50,100,100,120,120,100);
triangle(120,120,110,120,120,110);
// i can draw beziers
stroke(255);
bezier(120,70,200,150,195,195,275,275);
bezier(70,120,150,200,195,195,275,275);
bezier(140,70,220,170,170,220,250,300);
bezier(70,140,170,220,220,170,300,250);
bezier(120,70,220,170,170,220,250,300);
bezier(70,120,170,220,220,170,300,250);
bezier(350,320,220,190,170,240,90,160);
bezier(320,350,190,220,240,170,160,90);
stroke(226);
bezier(220,190,300,270,90,160,170,240);
bezier(190,220,270,300,160,90,240,170);
// i can draw curves
curve(230,150,230,160,230,180,300,240);
curve(150,230,160,230,180,230,240,300);
pop();
smooth();
}
void setup() {
size(400, 400);
}
010 -- Basic Primitives: Primitives not requiring BeginShape/EndShape
Statement:Assignments #01X will be due Tuesday 9/28, except for the "Abstract Clock", which will be due Thursday 9/30.
Create a simple composition which demonstrates your ability to command the following basic drawing primitives: point(), line(), triangle(), ellipse(), rect(), quad(), curve(), bezier(). The composition should have dimensions of 400x400 pixels, and you may use color. Reactivity and/or dynamism are not required; conserve your time.