Skip to content

Instantly share code, notes, and snippets.

@lizzybrooks
Created October 4, 2017 18:33
Show Gist options
  • Save lizzybrooks/fe48bfa83d892060b567ca0328878f00 to your computer and use it in GitHub Desktop.
Save lizzybrooks/fe48bfa83d892060b567ca0328878f00 to your computer and use it in GitHub Desktop.
//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.y,donut.diameter,donut.hole);
donut.x = donut.x+120;
}
}
function draw() {
}
//my donut function with inputs
function drawDonut(x, y, diameter, holeDiameter){
ellipse(x, y, diameter, diameter);
fill(255);
ellipse(x, y, holeDiameter, holeDiameter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment