Hi guys, I am creating a cherry blossom branch where you add a new flower object (via pressing z key) and delete flower object (via pressing m key). I want to make it before it display(), it plays a blooming animation when a new object is added, and a falling animation when an object is deleted.
How would I go about doing that? Thank you
Link to code: p5.js Web Editor
Consider how you would animate this one flower at a time instead of in a loop.
setup() runs once
draw() loops at 60 frames per second
- with and without background in
- something like this in
- only hints and not complete
Not a direct answer to your question… it may still gives you some ideas.
This is a simple timer that can be added to the class:
if (this.bb == false)
//this.tstart = millis()
this.tstart = frameCount
this.bb = true
//if(millis() < this.tstart+1000)
if(frameCount < this.tstart+60)
this.size += 1
this.bb = false
There is a
frameCount version and a
It is very rough code and did work in a simplified version of your code; I used circles in place of images.