// Han Yu
// Section D
// hyu1@andrew.cmu.edu
// Project-03
function setup() {
createCanvas(640,480);
}
function draw() {
noStroke();
var newx = 1000;
var newy = 1000;
background(0);
// changing colors of background
fill(255,mouseX/3,mouseY/3)
rect(0,0,1000,1000)
// spinning background
push();
translate(mouseX,mouseY);
fill(255,255,255,70)
rotate(mouseX);
triangle(0,0,newx-350,newy,newy,newx-350);
triangle(0,0,-newx+350,-newy,-newy,-newx+350);
triangle(0,0,-newx/2,newy,newy,newx+90000000);
triangle(0,0,-newx,newy-150,-150000000,-newx);
triangle(0,0,newx/2,-newy,-newy,-newx-90000000);
triangle(0,0,newx,-newy+150,150000000,newx);
pop();
// the moving pin
distance=int(dist(width/2,height/2,mouseX,mouseY))
push();
translate(mouseX,mouseY)
rotate((mouseX+mouseY)/50)
fill(150+distance*2,254,220+distance,90);
rectMode(CENTER);
ellipse(0,0,350-distance,350-distance,30);
rect(0,0,100-distance*2,250-distance*2);
rect(0,0,250-distance*2,100-distance*2);
pop();
}
I started out this project trying to make something hypnotizing. I also want my project to be more interactive so I added another element to make the whole picture following the mouse. The pin that follows the mouse was inspired by the kaleidoscope. Overall I think this project is very challenging but I learned a lot from working on it.