JESSIE ZHAI

Digital artist

A documentation page of rambling and experimenting.

@jessiehaseyes
jessiejiranzhai@gmail.com
02 VECTOR
NOC WEEK2




GO TO:
VECTOR



For the vector assignment, I modified one of my old sketches to use the createVector fucntion to optimize the movement of the flowers.



PROCESS



My original sketch uses the ml5 model to detect my hands, so when I pinch my index finger an thumb together it can move the falling flowers and release them.

To incorporate the createVector function, I’m using it mainly for the falling flowers. The tricky part about it is that I’m restraing the flowers within the canvas, so I needed to access the x and y axis while using vector, which took me a while to figure out.







First, I combined the x and y position and speed into position and velocity using createVector function.






The major change that I made for this sketch is the update function when the flowers is being pinched then released, how they would fly off the screen and disappear.

I used the add() to combine velocity with the x and y position, and setMag to constrain the magnitude to 1 for they velocity, so the if function still stands. I’m using this.pos.y to access the y position, which I did not know that I could do, to compare it to the flower radius. Once it is higher than the  height of the canvas and the radius of the flower, it accerlates and flies off the screen.

SOLVED PROBLEMS

  • accessing x and y within vectors 
  • createVector function


REFERENCES

Vectors - Nature of Code
Acceleration Vector - Coding Train

 


JESSIEZHAI