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

@porkchopsandwich/easers

v1.0.1

Published

A set of composable easing functions.

Downloads

1

Readme

Easers

A set of composable easing functions.

Installation

npm install --save @porkchopsandwich/easers

Use

import { linear, cubic, inverse } from "@porkchopsandwich/easers";

// Basic easers take an X value between 0 and 1, and return the matching Y value.
const y = linear(0.3); // => 0.3

// Other easers are higher order functions that operate on other easers
const invertedLinear = inverse(linear);
const y2 = invertedLinear(0.3);

Available easers

linear(x) => y

Returns the passed X as Y.

fixedFactory(x) => () => y

Returns an easer that always returns the initial value.

sineWaveFactory(amplitude = 1, ordinaryFrequency = 1, phase = 0) => (x) => y

Returns an easer that models a sine wave.

circular(x) => y

Models a circular easing.

exponential(x) => y

Models an exponential easing.

powerFactory(power = 1) => (x) => y

Returns an easer that models the passed power easing.

squared(x) => y

cubed(x) => y

quad(x) => y

Convenience easers for powers of 2, 3 and 4.

bounceFactory(baseline = 2.75) => (x) => y

Returns a 'bounce' easer (based on Robert Penner's easing methods: http://robertpenner.com/easing/)

elastic(x) => y

Models an elastic easer (based on Robert Penner's easing methods: http://robertpenner.com/easing/)

doubleArcFactory(max = 1.1) => (x) => y

Returns an easer that models a double arc.

Higher Order Easers

reverse(easer) => (x) => y

Returns an easer that flips the X value passed to the easer (1 to 0 rather than 0 to 1)

mirror(easer) => (x) => y

Returns an easer whose which produces a mirrored pair of the easer.

inverse(easer) => (x) => y

Returns an easer that flips the X value passed to the easer, AND flips the returned Y value. Effectively mirrors the easer on a diagonal.

pair(easer1, easer2) => (x) => y

Returns an easer that invokes easer1 for the first half of the X range, and easer2 for the second half.

inOut(easer) => (x) => y

Returns an easer that invokes easer normally for the first half of the X range, and the inverse of easer for the second half.

mean(...easers) => (x) => y

Returns an easer that returns the mean value returned by all the input easers.

sequence(...easers) => (x) => y

Returns an easer that breaks up the X value into a set matching the length of the input easers, and calls the appropriate one for the supplied X value.

set(...easerSets) => (x) => y

Easer Sets are a 3-tuples consisting of an easer, a start x and an end x. Returns an easer that returns the mean of all easers whose set starts before the input X and ends after the input X.

Utilities

toRange(x, min = 0, max = 1) => y

Converts a value between 0 and 1 to one on a range between min and max.

arrayMean(arrayOfNumbers) => y

Returns the average of all numbers in an array.