xxxxxxxxxx
//global
var boxX
var boxY
var boxXD=1//<> direction
var boxYD=1//^v direction
var boxXV=1.8
var boxYV=1.5
var Rgb=255
var rGb=255
var rgB=255
var img//image
function setup() {
createCanvas(windowWidth, windowHeight);//create screen
rectMode(CENTER)
imageMode(CENTER)
background(0);//black bg
boxX=width/2
boxY=height/2
}//close setup
function draw() {
//background(0);//black bg
//dvd logo thing
fill(Rgb,rGb,rgB)
noStroke();
//rect(boxX, boxY, 130, 72)
textSize(62)
textStyle(BOLDITALIC)
text('D',boxX-55,boxY+7)
text('V',boxX-18,boxY+7)
text('D',boxX+17,boxY+7)
rect(boxX-20,boxY-32.5,25,6)
rect(boxX+30,boxY-32,20,6)
//rect(boxX,boxY-100,150,75)
image(img,boxX,boxY-100,80,65)
//hole in the disc
ellipse(boxX, boxY+23, 130, 25)
fill(0)
ellipse(boxX, boxY+23, 32, 7)
//move X
boxX=boxX+boxXV*boxXD
//move Y
boxY=boxY+boxYV*boxYD
//logic
if(boxX>=width-65){//left wall
boxXD=boxXD*-1//change direction
boxYV=boxYV+1
}//close if
if(boxX<=+66){//top wall
boxXD=boxXD*-1//change direction
boxYV=boxYV-0.5
}//close if
if(boxY>=height-33){//bottom wall
boxYD=boxYD*-1//change direction
boxXV=boxXV+1
}//close if
if(boxY<=33){//top wall
boxYD=boxYD*-1//change direction
boxXV=boxXV-0.5
}//close if
}//close draw
function preload(){
img=loadImage('dvd_logo.png')
}//close preload