I was trying to emulate wave shapes and the movement of waves in this project. When the mouse is moved through the x axis, the strings are elongating towards the right of the canvas and when the mouse is moved through the y axis then the strings elongating downwards.
When the mouse is clicked the background color changes.
// Brandon Hyun
// 15-104 Section B
// bhyun1@andrew.cmu.edu
// Project 04
var increase = 15;
var xInt = 15;
var x1 = 0;
var y1 = 550;
var x2 = 550;
var y2 = 0;
var red;
var green;
var blue;
function setup() {
createCanvas(400, 300);
}
function draw() {
background (red,green,blue);
var m = 400/25;
for(var i = 0; i < m; i += 1) {
strokeWeight(1);
stroke(40,40,40);
for(var j =0; j<10; j+=1){
line(mouseX+40*j, increase * i, increase * i +40*j, y1);
}
for(var z =0; z<10; z+=1){
line(mouseY+ x2 - increase * i, y2+40*z, x1, increase * i+ 40*z);
}
}
}
function mousePressed() {
red = random(0,255);
green = random (0,255);
blue = random (0,255);
}