Lena - H

By wangl
//this project, i'd like to explore the change in directions, color, and size in relation to the mouse void setup() { color square; //background size(400,400); background(0); rectMode(CENTER); //making the rectangle CENTERED, so that it will be easier to manipulater } int s=100; //making the variable s to mean SIZE to be equal to 100 color c=color(162,162,162);// making the color to be grey void draw() { } void mouseMoved() //when the mouse moves, the square moves in opposite directions { background(0); //bg to be black fill(c); rect(-(mouseX-200)+200,-(mouseY-200)+200,s,s); } void mousePressed() //when mouse is pressed, the square is cut in half, repeatedly. but in theory, the square is never "gone". { s=s/2; background(0); rect(-(mouseX-200)+200,-(mouseY-200)+200,s,s); } void mouseReleased()//when mouse is released, the square's color changes to shades of grey according to the mouseX { c=color(mouseX,mouseX,mouseX); background(0); fill(c); rect(-(mouseX-200)+200,-(mouseY-200)+200,s,s); } void mouseDragged()//when mouse is dragged, the square increases size 2X { background(0); s=200; rect(-(mouseX-200)+200,-(mouseY-200)+200,s,s); } void keyPressed()//when the key "m" is pressed, it "resets" the square to it's initial state and size { if(key=='m') { s=100; } }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*