xxxxxxxxxx
39
function setup() {
createCanvas(400, 400);
}
let numFrames = 60;
function periodicFunction(p)
{
return map(sin(TWO_PI*p),-1,1,2,8);
}
function offset(x, y)
{
return 0.01*dist(x,y,width/2,height/2);
}
function draw() {
background(255);
const t = 1.0*frameCount/numFrames;
const m = 40;
stroke(0);
for(let i=0;i<m;i++)
{
for(let j=0;j<m;j++)
{
const x = map(i,0,m-1,0,width);
const y = map(j,0,m-1,0,height);
const size = periodicFunction(t-offset(x,y));
strokeWeight(size);
point(x,y);
}
}
}