xxxxxxxxxx
66
//The BIG BANG
//Play Big Bang by Chewiecatt
let ifClicked = 0, j = 0;
let maxDiameter = 1000;
let colors;
let colorIndex = 0;
let angle = 0;
let angleIncrement = 0.05;
function setup() {
createCanvas(windowWidth, windowHeight);
colors = [
color(0, 36, 93),
color(0, 101, 164),
color(255, 210, 0),
color(255, 255, 255)
];
frameRate(30)
}
function draw() {
background(0);
if (ifClicked == 0) {
if (j < maxDiameter) {
j += 10;
if (j % (maxDiameter / colors.length) == 0) {
colorIndex = (colorIndex + 1) % colors.length;
}
} else {
ifClicked = 1;
}
} else {
if (j > 0) {
j -= 10;
if (j % (maxDiameter / colors.length) == 0) {
colorIndex = (colorIndex + 1) % colors.length;
}
} else {
ifClicked = 0;
}
}
noStroke();
for (let i = j; i > 0; i -= 2) {
let interColor = lerpColor(colors[colorIndex], colors[(colorIndex + 1) % colors.length], (i / j));
fill(interColor);
ellipse(width / 2, height / 2, i);
}
angle += angleIncrement;
}
function mouseClicked() {
ifClicked = 1 - ifClicked;
}
function keyPressed() {
if (keyCode === UP_ARROW) {
maxDiameter += 10;
} else if (keyCode === DOWN_ARROW) {
maxDiameter -= 10;
}
}