-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Dobbiamo animare su base del tempo piuttosto che su base del frame. Così facendo si resta sostanzialmente indipendenti da eventuali accelerazioni o rallentamenti nella velocità dell'FPS dell'applicazione.
Utile a tale scopo potrebbe essere la funzione ofGetLastFrameTime di ofAppRunner.
Interessante a tale proposito il paragrafo sulla animazione nel libro ofBook
Altre funzioni del tempo che potrebbero essere utili per l'animazione sono (della classe ofUtils):
ofGetElapsedTimef()- returns the elapsed time in floating point numbers, starting from 0 when the app starts;ofGetElapsedTimeMillis()- similarly returns the elapsed time starting from 0 in milliseconds.ofGetFrameNum()- returns the number of frames the software has drawn. If you wanted, for example, to do something every other frame you could use the mod operator, e.g., if (ofGetFrameNum() % 2 == 0).
Reactions are currently unavailable