Suggestion: move cursor in circular motions around the canvas.
//Monica Chang
//Section D
//mjchang@andrew.cmu.edu
//Project-03
var angle = 0;
var x = 0;
function setup() {
createCanvas(640, 480);
noStroke();
rectMode(CENTER);
}
function draw() {
// changing color of background as mouse moves around canvas.
background(mouseX, mouseY, 245);
//mouseX controls x location
fill(255, 150);
ellipse(mouseX, mouseY, mouseY, mouseY);
// mouseY controls y location AND size
fill(0, 159);
ellipse(width - mouseX, mouseY, height - mouseY, height - mouseY);
//spiraling circle meant to indicate how to move your mouse around and play with it.
print(x);
push();
translate(width/2,height/2);
rotate(radians(angle));
fill("red");
ellipse (x ,0,50,50);
pop();
angle = angle +5;
x = x + 0.5;
//sending spiral circle return to center and then draw again>
if (x == 300){
x = 0;
}
}
I wanted to explore the use of depth perception within this piece by playing with the size and position. I also integrated what we learned in recitation where we created a spiral; however, I wanted to take it to another level by drawing it continuously while it redraws in a different position. Once it hits the edge of the canvas I wanted the spiral movement to continue again from the center. I struggled to get it to move smoothly but I am still happy with the results.