sketchDownload
// Ilia Urgen
// Section B
var angle = 0;
var color_1;
var color_2;
var background_lines = 0;
var triangle_1 = 1;
var triangle_2 = 2;
var triangle_3 = 3;
var triangle_4 = 4;
var triangle_5 = 5;
var triangle_6 = 6;
function setup() {
stroke (2);
createCanvas (800, 800);
color_1 = color (255,140,0);
color_2 = color (63,191,191);
for (var y = 0; y < height; y++ ) {
n = map (y,0, height, 0, 1);
var color_3 = lerpColor (color_1, color_2, n);
stroke (color_3);
line (0, y, width, y);
}
}
function draw() {
delta_x = mouseX/6;
delta_y = mouseY/6;
frameRate(30);
stroke (2);
push();
translate(400, 400);
rotate(radians(angle));
if (background_lines == 0) {
line (0,0, width, height);
line (width, 0, 0, height);
angle += 25;
}
if (triangle_1 == 1) {
// changes 1st darkest color gradient
fill (132-mouseX/4, 0, 132-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x + 100), delta_y + 150, (delta_x + 100), delta_y + 150);
angle += 5;
}
if (triangle_2 == 2) {
// changes 2nd darkest color gradient
fill (152-mouseX/4, 0, 152-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x + 80), delta_y + 120, (delta_x + 80), delta_y + 120);
angle -= 15;
}
if (triangle_3 == 3) {
// changes 3rd darkest color gradient
fill (176-mouseX/4,0,176-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x + 60), delta_y + 90, (delta_x + 60), delta_y + 90);
angle += 200;
}
if (triangle_4 == 4) {
// changes 4th darkest color gradient
fill (204-mouseX/4, 0, 204-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x + 40), delta_y + 60, (delta_x + 40), delta_y + 60);
angle -= 150;
}
if (triangle_5 == 5) {
// changes 5th darkest color gradient
fill (232-mouseX/4,0,232-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x + 20), delta_y + 30, (delta_x + 20), delta_y + 30);
angle += 100;
}
if (triangle_6 == 6) {
// changes 6th darkest color gradient
fill (255-mouseX/4,0,255-mouseY/4);
// changes thickness and width of triangle
triangle (0,0, -(delta_x), delta_y, (delta_x), delta_y);
angle -= 55;
}
pop();
}