xxxxxxxxxx
39
// Uses https://www.npmjs.com/package/p5.createloop
// Be sure that the following script is included in index.html:
// https://unpkg.com/p5.createloop@0.2.8/dist/p5.createloop.js
function setup() {
createCanvas(640, 640);
frameRate(30);
pixelDensity(1);
createLoop({
duration: 4,
gif: false
});
animLoop.noiseFrequency(0.45);
}
//------------------------------------------
function draw() {
background("DodgerBlue");
fill("white");
noStroke();
var seedOne = 1234; // these numbers can be anything
var seedTwo = 4444; // but if they are very close together
var seedThree = 3456; // the signals will correlate
// The noise values produced by animLoop.noise1D()
// range between -1 and 1, just like a sin wave
var x = map(animLoop.noise1D(seedOne), -1, 1, 0, width);
var y = map(animLoop.noise1D(seedTwo), -1, 1, 0, height);
var d = map(animLoop.noise1D(seedThree), -1, 1, 80, 320);
circle (x, y, d);
}