xxxxxxxxxx
74
let strt;
let ttl = 1000;
let nmbr;
let telt;
let i, R, G, B;
let batch = [];
let ang = 0.3;
let lng = 13;
let stxt = false;
function setup() {
createCanvas(2000, 1200);
background(0);
strokeWeight(3);
// stroke(0,20);
textSize(12);
translate(250, height - 750);
rotate(PI * .8);
line(0, 0, 0, lng);
for (strt = 2; strt < ttl; strt++) {
// print(nmbr);
// strt = 4096;
push();
nmbr = strt;
batch.length = 0;
print(batch[7]);
append(batch, nmbr);
while (nmbr > 1) {
if (nmbr % 2 == 0) {
nmbr = nmbr / 2;
} else {
nmbr = nmbr * 3 + 1;
}
append(batch, nmbr);
}
// append(batch, 1);
reverse(batch);
telt = 1;
R = random(150, 255);
G = random(150, 255);
B = random(150, 255);
stroke(R, G, B, 40);
for (i = 0; i < batch.length; i++) {
line(0, 0, 0, lng);
// print(batch[i]);
translate(0, lng);
if (batch[i] % 2 == 0) {
rotate(ang);
} else {
rotate(-ang * 1.605);
}
last = telt = telt + 1;
}
rotate(1.1 * PI);
translate(-16, 0);
if (stxt) {
text(strt + "-" + telt, 0, 0);
}
pop();
}
// nmbr = 5;
// // print(nmbr);
}
function draw() {
// background(220);
}