xxxxxxxxxx
41
// 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
var seeds = []
var pointsNum = 10;
function setup() {
createCanvas(640, 640);
frameRate(30);
pixelDensity(1);
createLoop({
duration: 4,
gif: true
});
animLoop.noiseFrequency(0.45);
for(var i = 0; i < pointsNum; i++){
seeds.push([random(0, 100), random(0, 100)]);
}
}
//------------------------------------------
function draw() {
background("DodgerBlue");
fill("white");
noStroke();
// The noise values produced by animLoop.noise1D()
// range between -1 and 1, just like a sin wave
for(var i = 0; i < pointsNum; i++){
var seedOne = seeds[i][0]; // these numbers can be anything
var seedTwo = seeds[i][1]
var x = map(animLoop.noise1D(seedOne), -1, 1, 0, width);
var y = map(animLoop.noise1D(seedTwo), -1, 1, 0, height);
circle (x, y, 10);
}
}