xxxxxxxxxx
let resolution = 260; // how many points in the circle
let rad;
let t = 0; // time passed
let tChange = 0.01; // how quick time flies
let nVal; // noise value
let nInt = 1; // noise intensity
let nAmp = 1; // noise amplitude
let pollen = [];
let pollenCounter = 0;
function pollenValues ()
{
pollen.push([]);
pollen[pollenCounter].push(windowWidth - 300); // x position
pollen[pollenCounter].push(random(100, windowHeight - 100)); // y position
pollen[pollenCounter].push(random(50, 200)); // radius
pollen[pollenCounter].push(random(0.1, 10)); // nInt
pollen[pollenCounter].push(random(0, 0.8)); // nAmp
pollen[pollenCounter].push(color(random(0, 360), 36, 87)); //color
pollenCounter++;
}
function pollenPath()
{
chance = round(random(0, 10));
if (chance == 0)
{
pollenValues();
}
for (let i = 0; i < pollenCounter; i++)
{
noStroke();
fill(pollen[i][5]);
nInt = pollen[i][3];
nAmp = pollen[i][4];
beginShape();
for (let a=0; a<= TWO_PI; a+=TWO_PI/resolution)
{
nVal = map(noise( cos(a)*nInt+1, sin(a)*nInt+1, t ), 0.0, 1, nAmp, 1); // map noise value to match the amplitude
rad = pollen[i][2];
x = (cos(a)*rad *nVal) + pollen[i][0];
y = (sin(a)*rad *nVal) + pollen[i][1];
vertex(x, y);
}
endShape(CLOSE);
t += tChange;
pollen[i][0] = pollen[i][0] - 10;
if (pollen[i][0] < -1000)
{
pollen.splice(i, 1);
pollenCounter--;
}
}
}
function setup()
{
createCanvas(windowWidth, windowHeight);
noiseDetail(8);
}
function draw()
{
background(255);
pollenPath();
}