Created
February 28, 2019 13:57
-
-
Save nickgs/85eb98b25a861487e446b3de68a969f9 to your computer and use it in GitHub Desktop.
DVD Logo Sketch v1
This file contains hidden or 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
var x; | |
var y; | |
var xspeed; | |
var yspeed; | |
// Our setup function. | |
function setup() { | |
createCanvas(800, 600); | |
background("#000000"); | |
x = 10; | |
y = 10; | |
xspeed = 10; | |
yspeed = 10; | |
} | |
// Our draw function. | |
function draw() { | |
background(20, 20, 20, 2); | |
if(x + 80 == width || x == 0) { | |
xspeed = xspeed * -1; | |
} | |
if(y + 60 == height || y == 0) { | |
yspeed = yspeed * -1; | |
} | |
circle(x, y, 80, 60); | |
x = x + xspeed; | |
y = y + yspeed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment