https://github.com/pqml/spring
:wavy_dash: Framerate-independant spring physics
https://github.com/pqml/spring
Last synced: 22 days ago
JSON representation
:wavy_dash: Framerate-independant spring physics
- Host: GitHub
- URL: https://github.com/pqml/spring
- Owner: pqml
- License: mit
- Created: 2018-10-04T10:24:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T17:15:13.000Z (over 6 years ago)
- Last Synced: 2025-03-18T03:46:18.933Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 264 KB
- Stars: 25
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.hbs
- License: LICENSE
Awesome Lists containing this project
README
# :wavy_dash: Spring
[:books: **Documentation**](#api) | [:tada: **Example**](https://pqml.github.io/spring) | [:globe_with_meridians: **Internet modules**](https://www.npmjs.com/org/internet)- Framerate-independant spring physics
- Small, < 1kb gzipped
- Control the spring with tension and friction
- Adjustable timestep for the physics solver
- `onStart` / `onStop` callbacks
- This lib was made to learn more about fixed timesteps and integration.
- It's a pretty basic Euler integration - not sure it will work for complex structures like spring chaining.
- If you need a rock-solid spring physics library, use [ReboundJS](https://github.com/facebook/rebound-js)
- Articles used :
- [Fix Your Timestep!](https://gafferongames.com/post/fix_your_timestep/)
- [Frame Rate Independent Damping using Lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/)
- [Integration by Example - Euler vs Verlet vs Runge-Kutta](http://codeflow.org/entries/2010/aug/28/integration-by-example-euler-vs-verlet-vs-runge-kutta/)
# Requirements
- ES6 Modules support
- Using a module bundler like Webpack, Rollup or Parcel
- [Native support from browser](https://caniuse.com/#feat=es6-module)
- From NodeJS with [esm](https://github.com/standard-things/esm)
# API
{{#globals name="Spring"}}
{{>member-index~}}
{{>members~}}
{{/globals}}