xxxxxxxxxx
25
let img;
let xPos = 400;
let yPos = 300;
// if you use preload, setup() will wait for loads to finish before runningfunction
function preload() {
img = loadImage("Cbridge.jpg");
}
function setup() {
createCanvas(800, 600);
background(100);
// display the loaded image at 0, 0
//image(img, 0, 0);
}
function draw() {
noStroke();
let ptCol = img.get(xPos/4, yPos/4);
fill(ptCol);
ellipse(xPos, yPos, 20);
let jitter = 10;
xPos += random(-jitter, jitter);
yPos += random(-jitter, jitter);
}