xxxxxxxxxx
50
let angle = 45;
function setup() {
createCanvas(800, 600);
stroke(255);
angleMode(DEGREES);
//noLoop();
sliderAngle = createSlider(0,360,45);
sliderSize = createSlider(0,1,0.66,0);
}
function draw() {
background(35);
angle = sliderAngle.value();
push();
translate(width/2,height);
drawFractal(200);
pop();
// translate(200,height);
// drawFractal(50);
}
function drawFractal(len) {
if (len <3) {
// if (random() < 0.05) {
// fill(255,0,0);
// circle(0,0,10);
// }
return;
}
line(0,0,0,-len);
translate(0,-len);
push();
rotate(angle);
drawFractal(len*sliderSize.value());
pop();
push();
rotate(-angle);
drawFractal(len*sliderSize.value());
pop();
}