Last active
November 6, 2017 18:57
-
-
Save lizzybrooks/e49d5951b1bcb9ad9b4f70462edaea0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This sketch draws a row of pink donuts. | |
//donut object | |
var donut = { | |
x:70, | |
y:200, | |
diameter:100, | |
hole:40 | |
}; | |
//pink color object | |
var pink = { | |
r : 200, | |
g : 0, | |
b : 100 | |
}; | |
function setup() { | |
createCanvas(1000, 600); | |
//draw 8 donuts | |
for (var i=0; i<6; i++) { | |
fill(pink.r,pink.g,pink.b); //here I can make my donut a color | |
drawDonut(); | |
donut.x = donut.x+120; | |
} | |
} | |
function draw() { | |
} | |
// my donut function | |
// notice I can remove the inputs because I now set those via the donut object at the top of the sketch. | |
function drawDonut(){ | |
ellipse(donut.x, donut.y, donut.diameter, donut.diameter); | |
fill(255); | |
ellipse(donut.x, donut.y, donut.hole, donut.hole); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment