Created
November 6, 2017 19:11
-
-
Save lizzybrooks/13969f8344e9a1fa2687447e89b38823 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 pink donut that moves across the screen. | |
//donut object | |
var donut = { | |
x:70, | |
y:200, | |
diameter:100, | |
hole:40, | |
drawDonut: function(){ | |
ellipse(this.x, this.y, this.diameter, this.diameter); | |
fill(255); | |
ellipse(this.x, this.y, this.hole, this.hole); | |
}, | |
moveDonut: function(){ | |
this.x = this.x+1; | |
} | |
}; | |
//pink color object | |
var pink = { | |
r : 200, | |
g : 0, | |
b : 100 | |
}; | |
function setup() { | |
createCanvas(1000, 600); | |
fill(pink.r,pink.g,pink.b); //here I can make my donut a color | |
} | |
function draw() { | |
background(255); | |
donut.drawDonut(); | |
donut.moveDonut(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment