Code viewer for World: Tutorial 2.1 (clone by Jo...

// Cloned by John McCormack on 1 Oct 2023 from World "Tutorial 2.1 " by "Coding Train" project 
// Please leave this clone trail here.
 


/*
https://vimeo.com/channels/learningp5js/138327548
*/

var r = 200;
var g = 130;
var b = 240;
var circle = {
    x : 0,
    y : 200,
    diameter : 50
}

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

function draw() {
  background(r, g, b);


  // ellipse
  fill(250, 200, 200);
  ellipse(circle.x, circle.y, circle.diameter, circle.diameter);
  
  // rectangle
  fill(200, 250, 200);
  rect(400, 100, 50, 50);
  
  if (circle.x <= 700){
        circle.x += 1;
  }
  else{
      circle.x = 0;
  }
      
  }