skevy / wobble

A tiny (~1.7 KB gzipped) spring physics micro-library that models a damped harmonic oscillator.
https://wobble-demos.now.sh
MIT License
842 stars 19 forks source link

Multiple springs / spring system #8

Open JonDum opened 6 years ago

JonDum commented 6 years ago

Works well for a single spring, but starts being a major performance snag having many Springs all calling requestAnimationFrame.

Using this in a webgl app targeting 60fps.

Is there a way to not have them all register their own raf on every _step and instead manually loop each one? Similar to how rebound does it?

I have a single raf callback that I do all polling, updating, and then drawing in. Multiple raf's kill the performance.