project-04-stringDownload
// Huijun Shen session D
// huijuns@andrew.cmu.edu
var gray = 0;
function setup() {
createCanvas(600,450);
background(100);
strokeWeight(0.5);
}
function draw() {
background(100);
gray = mouseX/ 2;
fill(255-gray);
noStroke();
circle(width / 2, height / 2, 450);
dist(mouseX , mouseY , width/2, height/2 )
for(var i = 50; i <= 600; i += 50){
if(dist (mouseX, mouseY, width/2, height/2 ) < 225 ){
stroke(255);
line(i, 0, constrain(mouseX, 75, 525), constrain(mouseY,0,450));
line(constrain(mouseX, 75, 525), constrain(mouseY,0,450), i , height);
} else {
stroke(0);
line(i, 0, constrain(mouseX, 75, 525), constrain(mouseY,0,450));
line(constrain(mouseX, 75, 525), constrain(mouseY,0,450), i , height);
}
}
for( var e = 30; e <= 450 ; e += 10){
line(0,e,mouseX,i);
line(600,e,mouseX,i);
}
}