Hand - Flower Picker

https://editor.p5js.org/[email protected]/sketches/qZmB4C4TS

For this week’s assignment, I created a sketch where users can spawn a flower when pinching their left index and thumb fingers.

Documentation

Recorded.mov

Creation - Code explanation

The flower is created using the class function below. I referenced the project on Open Processing.

Inside the drawFlower function, I check whether two fingers meet by using dist() function, and if yes, I added the flower to the flowerArray []. I used true/false statement to prevent adding too many flowers at once.

Draw() function is where flowers are drawn and disappears. Here, I check whether each flower satisfies the finished() state (measured by opacity) and splice it when it’s finished.


<aside> 🔐 Reading & Watching: