xxxxxxxxxx
26
function setup() {
createCanvas(400, 400);
fill(0);
/* if you're on a Mac with a retina screen,
* pixel density is 2 and then this library
* generates a gif at TWICE the size your canvas is
* so we preemptively set it 1 for all systems
*/
pixelDensity(1);
createLoop({duration:2, gif:true});
}
function draw() {
background(255);
const radius = height / 3;
/* animLoop is a nice object that has looping-friendly variables
* animLoop.noise() returns a noise value between -1 and 1
*/
const x = animLoop.noise() * radius;
text(x, 10, 20);
ellipse(x + width/2, height/2, 50, 50);
}