I Got Your Nose! (In Code)
This was before we learned about objects and classes, so the code for this sketch is quite messy and cumbersome to comb through. So lets break this down.
The assigned value to "noseX1" is "canvasX - 5" which means that the elements are justified along the center of the canvas (see line 8 for "canvasX") but offset to the left by 5 pixels, while "noseY1" is assigned the value of "height - 230" which means it is justified to the bottom of the canvas, or full height, and then offset upward by 230 pixels. This is because the rest of the portrait elements are aligned to the bottom and center of the canvas, so should the canvas size change, the portrait elements will move together in alignment. Then we have "noseY2", which has an assigned value of "noseY1 + 20", and "noseY3", which has an assigned value of "noseY1 + 30". These two variables both reference "noseY1" in their values, because I want for the rest of the nose to be drawn based on the fixed information of "noseY1", this also will become much easier for when I want to include the mouse interaction. So, "noseY2" is 20 pixels below "noseY1", which draws the line at 20 pixels long, and "noseY3" is 30 pixels below "noseY1", which will place the arc center point 10 pixels below the line. These assigned values will serve as their starting positions prior to any mouse interaction on the sketch. So let's get into the interaction part of the code!
But this update us SUPER fast! Specifically 1/60th of a second since P5.js draws 60 frames per second. So in 1/60th of a second, noseX1 went from 100 to 300, which cannot be observed by the human eye. Unless you are superman or Flash, which then you are not human. I need to slow the movement down for the human eye! Another observation to note here is that not only is it the value of "noseX1" incrementing at a smaller number, it is also slowing down as it approaches the final destination. So there is a declaration aspect to this mouse interaction as well!
Comments are closed.
|
Blog posts and other documentation from NYU ITP classes
Categories |