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

@kohlmannj/easing

v1.2.2

Published

Easing Functions Without the Framework Cruft

Downloads

4

Readme

| testing | coverage | | ------- | ---------| | Build Status | Coverage Status |

easing

easing

    const Easing = require('easing')

    const x = Easing(11,'linear')
    // [ 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 ]

    const y = Easing(11,'quadratic')
    // [ 0, 0.01, 0.04, 0.09, 0.16, 0.25, 0.36, 0.49, 0.64, 0.81, 1 ]

install

npm install --save easing

On the client

drop it in

Simply include browser-easing.js and you can directly use the Easing function globally

    <script src="browser-easing.js"></script>
    <script>
    var x = Easing(11,'cubic');
    console.log(x)
    </script>

or with browserify

const Easing = require('easing')

Differences from the Original Package

This is a fork of rook2pawn/node-easing with the following changes:

  • Transpile source files with Babel
  • Create a library build using Webpack + babel-loader

Motivation

As distributed, the original project's source files, including rook2pawn/node-easing/browser-easing.js, are not valid ES5. This leads to knock-on issues, such as when bundling the library with a tool that uses UglifyJS:

js/main-ec3d69cc.js from UglifyJs
Unexpected token operator «=», expected punc «,» [../node_modules/easing/browser-easing.js:8,0][js/main-ec3d69cc.js:28118,46]

Hence, this fork transpiles the source files to valid ES5:

  • The lib folder contains individual transpiled source files
  • browser-easing.js, a UMD module as before, is also transpiled

Types of Easing

Linear

For an array of 42 values that are linear,

Easing(42,'linear')

Quadratic

For an array of 100 values that are quadratic,

Easing(100,'quadratic')

Cubic

For an array of 42 cubic values,

Easing(42,'cubic')

Quartic

For an array of 1492 quartic values,

Easing(1492,'quartic')

Quintic

Easing(25,'quintic')

Sinusoidal

Easing(333,'sinusoidal')
Easing(333,'sin')

Circular

Easing(314,'circular')

Exponential

Easing(81,'exponential')

options

endToEnd

If we wanted to go from 0 to 1 back to 0 quadratically, simply call

Easing(100,'quadratic',{endToEnd:true});

invert

If we want to go from 1 to 0 (or 1 to 0 back to 1) instead of 0 to 1, say 'linear' style, simply call

Easing(100,'linear',{invert:true});

You can mix and match these options.

additional interfaces

Event interface

    const Easing = require('easing')
    const x = Easing.event(11,'linear')
    x.on('data', (data) => { ... })

Stream interface

    const Easing = require('easing')
    const x = Easing.stream(11,'linear')
    x.pipe(process.stdout)

These two interfaces have their own options duration and repeat that you can also mix and match.

These two interfaces can take one or all of these options

  • invert : boolean
  • endToEnd : boolean
  • duration : integer (milliseconds, defaults to 1000)
  • repeat : boolean (default false)

LICENSE

MIT