xxxxxxxxxx
95
let gr, ga;
let turnRad = 0;
let pointNum = 0;
let bins = [];
let clr1;
let nodes = [];
function setup() {
createCanvas(400, 400);
clr1 = color(105, 168, 79);
// color(204, 2, 2);
// color(102, 78, 167)//
angleMode(DEGREES);
textAlign(CENTER, CENTER);
gr = (sqrt(5) + 1) / 2;
ga = (2 - gr) * (360);
for(let i = 0; i < 500; i ++) {
bins[i] = round(random());
}
frameRate(30);
}
function fibbonacciDisc(x, y, num, scale, turn) {
for(let i = 0; i < num; i ++) {
let r = sqrt(num-i)*scale;
let a = turn*i;
let xPos = x + cos(a) * r;
let yPos = y + sin(a) * r;
push();
translate(xPos, yPos);
rotate(a)
noStroke();
fill(red(clr1), green(clr1), blue(clr1), 130*(500-i)/500);
textSize(15);
for(let j = 0; j < 21; j += 3) {
if((i+8*j) % 21 == 0) fill(red(clr1), green(clr1), blue(clr1), 255*(500-i)/500);
}
text(bins[i], 0, 0);
// else circle(0, 0, 2);
pop();
}
}
function spiral(x, y, num, scale, turn) {
for(let i = 0; i < num; i ++) {
let r = i*scale;
let a = turn*i;
let r1 = (i+1)*scale;
let a1 = turn*(i+1);
let xPos = cos(a) * r + x;
let yPos = sin(a) * r + y;
let xPos1 = cos(a1) * r1 + x;
let yPos1 = sin(a1) * r1 + y;
stroke(0);
strokeWeight(2);
point(xPos, yPos);
if(i < num) {
line(xPos, yPos, xPos1, yPos1);
}
}
}
function draw() {
background(0);
strokeWeight(8);
stroke(clr1);
noFill();
rectMode(CENTER);
// rect(width/2, height/2, 336, 100);
fibbonacciDisc(width/2, height/2, round(pointNum), 8, ga);
// fill(200);
// fill(clr1);
// strokeWeight(0);
// textSize(80);
// text("CSML", width/2, height/2);
if(pointNum < 420) pointNum += 2;
else {print(frameCount); noLoop();}
}