xxxxxxxxxx
61
t=179.95
dt=0.0005;
depth=450
STROKEWEIGHT=4;
function setup() {
createCanvas(windowWidth, windowHeight);
strokeWeight(6)
createSlider(0,179.9,1,.005).input(function(e) {t=this.value();createPattern(this.value())})
createSlider(4,2000,depth,).input(function(e) {depth=this.value();createPattern(t)})
createSlider(1,10,STROKEWEIGHT,1).input(function(e) {strokeWeight(this.value())})
createPattern(t)
}
function createPattern(t){
loop()
push()
background(220);
translate(width/2, height/2)
var ps = []
var p = createVector(width/2, 100)
var c = createVector(width/2, height/2)
var a = 0;
while (ps.length < depth)
{
ps.push(p.copy())
const d = p5.Vector.sub(p, c)
p.rotate(a)
a+= radians(t)
}
for (var i = 0; i < ps.length-1; i++)
{
const p1 = ps[i]
const p2 = ps[i+1]
push()
stroke(p1.x, p2.x, sin(p2.y+p1.y))
line(p1.x, p1.y, p2.x, p2.y)
pop()
}
pop();
}
function draw(){
createPattern(t)
t+=dt
}