//Hannah Kim
//Section A
//hannahk2@andrew.cmu.edu
//Project-04
function setup() {
createCanvas(300, 400);
}
function draw() {
background(0);
//make rows of lines stemming from the center
//change opacity of lines to give glowing effect
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(143, 204, 51, 85);
line(150, 200, lineW, 50);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(114, 163, 41, 90);
line(150, 200, lineW, 100);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(86, 122, 31, 95);
line(150, 200, lineW, 150);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
//use map function to make middle row of lines
//lines move up and down if mouse moves up and down
var lineY = map(mouseY, 0, 200, 0, 400);
stroke(59, 92, 10);
line(150, 200, lineW, lineY);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(86, 122, 31);
line(150, 200, lineW, 250);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(114, 163, 41);
line(150, 200, lineW, 300);
}
for (var lineW = 50; lineW < 250; lineW += 8) {
stroke(143, 204, 51);
line(150, 200, lineW, 350);
}
}
My goal for this project was really just to get comfortable using the for loop function. I really wanted to create a laser-esque feeling effect by using layers of string groups and making one “scan” from the top of the canvas to the bottom.