submission by jtoy Original version by: randydandy
function setup(){
  var myCanvas = createCanvas(windowWidth,windowHeight); //you must keep this line unmodified
  ballx = width/2
  bally = height/2

  xdirection = random(-10,10)
  ydirection = random(-10,10)
}

function draw() { 
noStroke()
  //start writing your code here
 background(0,0,0,5)
  stroke(0,255,0)

strokeWeight(5)
  line(0,height/2,width,height/2)
  line(width/2,0,width/2,height)
noStroke()
  fill(255,0,0)
  ellipse(ballx,bally,20,20)
  ballx +=xdirection

  if(ballx > width || ballx < 0){
     xdirection *= -1
  }

  if(bally > height){
    ydirection *= -1
  }else if(bally < 0 ){
    ydirection *= -1
  }
  bally+=ydirection
}