/*Jeremy Turner (JOT) Assignment A2-11 #200024742 Create a responsive image that behaves differently when the mouse is moving and the mouse is dragging. */ int visibleEvent = 0; //I changed the int name from "value" to "visibleEvent" //...so I could remind myself what this value is meant to do... //when the mouse is pressed and releases... //...with a name like "value", I get confused with other... //...variables... float wackyMovement1 = random(333); float wackyMovement2 = random(22); //I called it "wackyMovement" because I was going to do a wackier movement but then I felt the current movement... //..that I set with the randomized float numbers worked better with the kind of responsive image that I have made. void setup () { size (333, 333); background (235, 252, 0); } void draw() { fill(random(255), visibleEvent, visibleEvent); rect(wackyMovement1/PI, visibleEvent, wackyMovement2, 50); } void mouseMoved() { if(wackyMovement1 == 0) { wackyMovement1 = random(255); } else { wackyMovement1 = 0; } } //ABOUT THE MOUSEMOVING FUNCTION //By moving mouse, the you virtually scroll the... //oscillating vertical stripes across the horizontal banner... //this action only works from left-right (when you move the mouse left, //... the stripes will still scroll to the right) //but that is intentional because... //the responsive image subliminally encourages you to drag the stripes further... //across the banner and thereby, allowing this reponsive image to grow across the screen. void mouseDragged() { if(visibleEvent == 0) { wackyMovement2 = mouseX; //When the mouse is dragged to the left, //...more lines draw across the banner. //When the mouse is dragged to the right, //...the drawn lines are gradually cleared... //...with one oscillating red colour-field. } else { visibleEvent = 0-1; } //ABOUT THE MOUSEDRAGGING FUNCTION //In this case, I scrambled the "if" statements around... //..so that I could have the shape evolve/grow horizontally when dragging the mouse... //...from left-right. //The dragging only expands the stiped banner horizonatally when certain float values were found. //you might have to drag my striped banner... // to the right numerous times before... //..it actually expands horizontally across... //..the top row of the x-axis. //On a side note, I have started remember in my head all the different... //..mouse functions...For initial reference, I consulted: //http://processing.org/reference/mouseReleased_.html //...and pasted a function there into... // http://processing.org/reference/mousePressed.html //I then fixed the syntax to make sure the function calls... //..and their default variables did not cancel each other out... //from there, I changed the action from mousePressed and mouseReleased to mouseMoved and mouseDragged }