springer

0.0.1 • Public • Published

Springer

A spring that generates realistic easing functions

Features

  • 1 kb! (minified)
  • Tension & Wobble parameters
  • No dependencies
  • Compatible with any animation library

Demo

Installation

$ yarn add springer
# or 
$ npm install springer --only=dev
CDN
<script src='https://unpkg.com/springer@latest/springer.js'></script>

Usage

  • springer(tension, wobble)
    • tension
      • The percentage of force the spring has before release.
      • Min: 0
      • Max: 1
      • Default: 0.5
    • wobble
      • The percentage of wobble, or malleability the spring exhibits
      • Min: 0
      • Max: 1
      • Default: 0.5
  • Returns an spring-based easing function

Example

import springer from 'springer'
 
const spring = springer(0.5, 0.8)
 
console.log(spring(0))   // 0
console.log(spring(0.2)) // 0.80516
console.log(spring(0.4)) // 1.01897
console.log(spring(0.6)) // 1.00010
console.log(spring(0.8)) // 0.99974
console.log(spring(1))   // 1

Contributing

To suggest a feature, create an issue if it does not already exist. If you would like to help develop a suggested feature follow these steps:

  • Fork this repo
  • $ yarn
  • Implement your changes to files in the src/ directory
  • Submit PR for review

Scripts

  • $ yarn run test Runs the test suite
  • $ yarn run prepublish Builds for NPM distribution

Used By

Nozzle Logo

Package Sidebar

Install

npm i springer

Weekly Downloads

2,423

Version

0.0.1

License

MIT

Last publish

Collaborators

  • tannerlinsley