New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

spring-animator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spring-animator

a little tool for animating scalar and vector values with spring forces

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

spring-animator

stable

A little tool for easing values with spring forces for animations.

Here's an example.

Install

Use npm to install.

npm install spring-animator --save

Usage

import { createSpring } from 'spring-animator'

const stiffness = 0.003
const dampening = 0.1
const startingValue = 10

const spring = createSpring(stiffness, dampening, startingValue)

// must first set a new destination value to animate towards
spring.setDestination(15)

spring.tick() // takes one step towards destination value

// pass custom stiffness and dampening values for just this tick
spring.tick(0.003, 0.1)

const value = spring.getCurrentValue() // returns the current value

I personally like these values:

{
  stiffness: 0.003,
  dampening: 0.1
}

To run the example:

npm install
npm start

And then make sure to open example/index.html in a browser!

Or you can just try it out here.

NPM

License

MIT, see LICENSE.md for details.

Keywords

animate

FAQs

Package last updated on 18 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts