npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easing-utils

v1.0.0

Published

A collection of configurable easing functions for Javascript that takes in a value from 0 to 1 and returns the eased value

Downloads

2,390

Readme

Javascript Easing Functions

A collection of configurable easing functions for Javascript.

Demo

See the demo that accompanies this repository for examples of each tween function.

Usage

Vanilla Javascript

Download the built file and include it in your project. Do not hotlink to this file!

<script src="easing.js"></script>

Then reference the global "easing" variable:

// Pass in a value from 0 - 1 and get the eased value back
easing.easeInCube( 0.5 );

ES6

Install with npm install --save easing-utils

// Curly braces needed for import
import { easeInCubic, easeInOutBounce } from 'easing-utils';

// Pass in a value from 0 - 1 and get the eased value back
const eased = easeInCubic( 0.5 );

CommonJS

Install with npm install --save easing-utils

var easing = require('easing-utils');

// Pass in a value from 0 - 1 and get the eased value back
var eased = easing.easeInCubic( 0.5 );

API

All values are from 0 to 1.

Some functions take an optional magnitude argument. The ranges vary per function, and usually determine how far past zero the tween goes.

number:linear( value:number )

number:easeInSine( value:number )

number:easeOutSine( value:number )

number:easeInOutSine( value:number )

number:easeInQuad( value:number )

number:easeOutQuad( value:number )

number:easeInOutQuad( value:number )

number:easeInCubic( value:number )

number:easeOutCubic( value:number )

number:easeInOutCubic( value:number )

number:easeInQuart( value:number )

number:easeOutQuart( value:number )

number:easeInOutQuart( value:number )

number:easeInQuint( value:number )

number:easeOutQuint( value:number )

number:easeInOutQuint( value:number )

number:easeInExpo( value:number )

number:easeOutExpo( value:number )

number:easeInOutExpo( value:number )

number:easeInCirc( value:number )

number:easeOutCirc( value:number )

number:easeInOutCirc( value:number )

number:easeInBack( value:number, /*optional */magnitude:number )

number:easeOutBack( value:number, /*optional */magnitude:number )

number:easeInOutBack( value:number, /* optional */magnitude:number )

number:easeInElastic( value:number, /* optional */magnitude:number )

number:easeOutElastic( value:number, /* optional */magnitude:number )

number:easeInOutElastic( value:number, /* optional */magnitude )

number:easeOutBounce( value:number )

number:easeInBounce( value:number )

easeInOutBounce( value:number )

Development

First install all dependencies:

npm install

To build the standalone Javascript file, run:

npm run build-cdn

The output is put in the dist/ folder.

The website deployed here lives in the gh-pages/ folder. To deploy the website, run npm run gh-pages. Then go to http://[your username].github.io/easing-utils/gh-pages/. Out of laziness, I have not yet set up a development server to work on the Github pages.

About

What does this library have that others don't?

There's a few other easing libraries out there, but none of them met my needs, which are:

  • Fully documented
  • Configurable easing functions where available
  • Examples presented clearly
  • Available through npm
  • High quality, readable source code
  • Only take a single parameter, which is the initial value from 0 to 1