xxxxxxxxxx
//------------------------------------------------------
// Color_Smoke converted from P5.js to JavaScript
// fork of https://www.openprocessing.org/sketch/422525
//------------------------------------------------------
int numPoints = 360;
float startcol;
void setup()
{
size(1200, 600, P2D); // set screen size & renderer
background(255);
noFill();
strokeWeight(2.);
colorMode(HSB);
startcol = random(0,255);
}
void draw()
{
float sx=0, sy=0;
float cx = frameCount * 2 - 200;
float cy = height / 2.5 + 50 * sin(frameCount / 50.0);
float hue = (cx / 10 - startcol) % 256;
if(hue < 0) hue += 255;
stroke(hue, 255, 220, 12);
beginShape();
for(int i = 0; i < numPoints; i++)
{
float angle = map(i, 0, numPoints, 0, TWO_PI); // 0..360°
float xx = 100 * cos(angle + cx / 10);
float yy = 100 * sin(angle + cx / 10);
PVector v = new PVector(xx, yy);
xx = (xx + cx) / 150;
yy = (yy + cy) / 150;
v.mult(1 + 1.5 * noise(xx, yy));
vertex(cx + v.x, cy + v.y);
if(i == 0) { // save start point
sx = cx + v.x;
sy = cy + v.y;
}
}
vertex(sx, sy);
endShape();
if(frameCount > width + 500)
noLoop();
}