Skip to content

Instantly share code, notes, and snippets.

@fewlinesofcode
Created June 22, 2020 21:31
Show Gist options
  • Save fewlinesofcode/7b08837442d6c3db77d66507a697560d to your computer and use it in GitHub Desktop.
Save fewlinesofcode/7b08837442d6c3db77d66507a697560d to your computer and use it in GitHub Desktop.
// Twitter: @fewlinesofcode
var angle = 1.0;
var angularSpeed = 0.01;
var internalRadius = 130;
function setup() {
createCanvas(600, 600);
noStroke();
background(255);
}
function draw() {
noFill();
stroke(0);
background(255);
let r = 0;
let numPts = 100;
let numCircles = 20;
let offset = 6;
noiseSeed(1);
for (let k = 0; k < numCircles; k++) {
r = k * offset;
for (let i = 0; i <= numPts; i++) {
var x = sin(2 * Math.PI * i / numPts + (cos(angle)==0));
var y = cos(2 * Math.PI * i / numPts + sin(angle));
speed = noise(x, y) * internalRadius;
x = width / 2 + x * (r + speed);
y = height / 2 + y * (r - speed);
if (i > 0) {
line(prevX, prevY, x, y);
}
prevX = x;
prevY = y;
}
}
angle += angularSpeed;
// noLoop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment