Jupyter at Bryn Mawr College |
|||
Public notebooks: /services/public/dblank / CS110 Intro to Computing / 2017-Spring / Notes |
Notebook by Doug Blank
void setup() {
size(200, 100);
}
void draw() {
drawLeaf(50, 50, 20, 20);
drawLeaf(120, 50, 70, 70);
}
void drawLeaf(float x, float y, float w, float h) {
fill(255);
float p1x = x - w * 0.6;
float p1y = y;
float p2x = x + w * 0.4;
float p2y = y - h * 0.7;
float p3x = x;
float p3y = y + h * 0.3;
triangle(p1x, p1y, p2x, p2y, p3x, p3y);
fill(0, 255, 0);
ellipse(x, y, 5, 5);
}