Move mouse from left to right and back

Self-explanatory really. Just try it. As you do it, the background changes. Code is below. Also if you cannot see the effect on your phone click on this link. It will open in a new tab (just place a finger anywhere on the small rectangular canvas and you will see the effect instantly).

var col = 0;

function setup() {
  createCanvas(600, 400);

function draw() {
  col = map(mouseX, 0, 600, 0, 255);
  fill(250, 118, 222);
  ellipse(mouseX, 200, 50, 50);

Leave a Reply