Not a rising moon btw

This is the link. Try moving the mouse over the canvas for an additional effect.

Code:

var newShapez;
var shapez;
var x = 200
var y = 400
var stop = y/2
var speed = 1

var extraCanvas;


function setup() {
  createCanvas(windowWidth, windowHeight);
  extraCanvas = createGraphics(windowWidth, windowHeight)
  //extraCanvas.clear()
}

function draw() {
  background(0, 0, 220);
  
  fill(255)
  noStroke()
  ellipse(x, y, 100, 100)
  y = y - speed
  
  shapez = {
    locationX: random(width),
    locationY: random(height),
    size: random(5, 3)
  }
  
  if(y < stop){
    //image(extraCanvas, 0, 0)
    y = y + speed
    background(255, 0, 0, 25)
    background(0, 0, 0, 25);
    fill(0, 0, 255)
    noStroke()
    ellipse(shapez.locationX, shapez.locationY,     shapez.size, shapez.size)
  }
  
  newshapez = {
    locationX: random(width),
    locationY: random(height),
    size: random(5, 3)
  }
  extraCanvas.fill(255, 0, 0)
  extraCanvas.noStroke()
  extraCanvas.ellipse(mouseX, mouseY, newshapez.size, newshapez.size)
  
  image(extraCanvas, 0, 0)
}

Leave a Reply