/** * Drawing a star. * *

Elie Zananiri
* CART 253, Winter 2008

*/ void setup() { size(400, 400); smooth(); noStroke(); } void draw() { background(0); // draw a star at the current mouse position fill(216, 61, 4); drawStar(mouseX, mouseY, 100); } void drawStar(int xPos, int yPos, int starSize) { beginShape(); vertex(xPos, yPos-starSize/2); vertex(xPos-starSize/3, yPos+starSize/2); vertex(xPos+starSize/2, yPos-starSize/8); vertex(xPos-starSize/2, yPos-starSize/8); vertex(xPos+starSize/3, yPos+starSize/2); vertex(xPos, yPos-starSize/2); endShape(); }