soulwire / sketch.js

Cross-Platform JavaScript Creative Coding Framework
MIT License
4.09k stars 431 forks source link

Added performance.now() and canceled rAF after stop() #90

Closed ghost closed 7 years ago

ghost commented 7 years ago

Currently, operations after stop().

screen shot 2016-12-08 at 07 51 14

With the proposed changes.

screen shot 2016-12-08 at 07 53 07

I took the liberty of adjusting the init/start/stop lifecycle and time handling in function of the rAF callback lifecycle.

I tried to match your coding style, but some air may be missing here and there. :)

[1] Minus the last frame, which is a shortcoming that might need to be addressed.