xxxxxxxxxx
45
var steps = [];
var color_schema = {
0: [255, 255, 255],
1: [255, 0, 0],
2: [0, 255, 0],
3: [0, 0, 255],
4: [255, 0, 255]
}
var colors = [0, 0, 0, 0];
function draw_commits() {
stroke(255, 255, 255);
for (let i = 0; i < 4; i++) {
let color = color_schema[colors[i]];
fill(color[0], color[1], color[2]);
circle(i * 80 + 40, 730, 70);
}
}
function setup() {
createCanvas(400, 800);
}
function draw() {
background(31);
draw_commits();
}
function mouseClicked() {
for (let i = 0; i < 4; i++) {
let dist = sqrt(pow(mouseX - i * 80 + 40, 2) + pow(mouseY - 730, 2));
if (dist < 35) {
console.log(i);
console.log(mouseX, mouseY)
colors[i] = constrain(colors[i] + 1, 0, 4);
break;
}
}
}