Giter VIP home page Giter VIP logo

easing-utils's Introduction

Javascript Easing Functions

A collection of configurable easing functions for Javascript.

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

easing-utils's People

Contributors

andrewraycode avatar pixelass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

torocruzand

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.