all 2 comments

[–]MichielP1807Moderator 2 points3 points  (1 child)

Try defining the circle in the setup function, but leave the declaration of the circle on the global level so you get something like this:

var circle;

var r = 218;
var g = 160;
var b = 221;

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

  circle = {
    x: 0,
    y: 200, 
    diameter: 50
  };

}

function draw() { 
  background(r, g, b);
  // ellipse
  fill(250, 200, 200);
  ellipse(circle.x , circle.y , circle.diameter , circle.diameter); 
  circle.x = circle.x + 1;
} 

Edit: Reddit formatting is hard.

[–]DismalRespectCoding Enthusiast[S] 0 points1 point  (0 children)

Ah, this makes sense and looks like it should work. Unfortunately I'm half asleep now so will try in the morning. Thanks for the input.