Giter VIP home page Giter VIP logo

shifty's Introduction

Shifty - A teeny tiny tweening engine in JavaScript

Shifty is a tweening engine for JavaScript. It is a lightweight library meant to be encapsulated by higher level tools. At its core, Shifty provides:

  • Interpolation of Numbers over time (tweening)
  • Playback control of an individual tween
  • Extensibility hooks for key points in the tweening process

This is useful because it is the least amount of functionality needed to build customizable animations. Shifty is optimized to run many times a second with minimal processing and memory overhead, which is necessary to achieve smooth animations.

Installation

npm install --save shifty

Browser compatibility

Shifty officially supports Evergreen browsers, Safari, and Node. If you encounter a browser-specific bug, please open an issue about it!

IE compatibility

Shifty is compatible with IE11 (possibly older versions as well), but you will need to provide your own polyfills for it to work. If you are using https://polyfill.io/, you just need the es6 features enabled:

https://polyfill.io/v3/polyfill.min.js?features=es6

Here's a polyfilled demo of Shifty that works with IE11. Please see issue #113 for background on this.

Developing Shifty

First, install the dependencies via npm like so:

npm install

Once those are installed, you can generate dist/shifty.js with:

npm run build

To run the tests:

npm test

To generate the documentation (dist/doc):

npm run doc

To generate live documentation in your browser:

npm run doc:live

Loading Shifty

Shifty exposes a UMD module, so you can load it however you like:

// ES6
import { tween } from 'shifty';

Or:

// AMD
define(['shifty'], function(shifty) {
  shifty.tween({ from: { x: 0 }, to: { x: 10 } });
});

Or even:

// CommonJS
// Shifty is packaged for ES6 environments, so it exposes an object called
// `shifty`. To use it with CommonJS loaders (like Node's `require`), access
// the properties within that object.
const shifty = require('shifty').shifty;

shifty.tween({ from: { x: 0 }, to: { x: 10 } });

Using Shifty

Please see the Getting Started guide and check out the API documentation.

Contributors

Take a peek at the Network page to see all of the Shifty contributors.

Special thanks goes to Thomas Fuchs: Shifty's easing formulas and Bezier curve code was adapted from his awesome Scripty2 project.

License

Shifty is distributed under the MIT license. You are encouraged to use and modify the code to suit your needs, as well as redistribute it.

shifty's People

Contributors

jeremyckahn avatar millermedeiros avatar vascanera avatar 3rd-eden avatar unstoppablecarl avatar sboudrias avatar kris-b avatar joelambert avatar laurieboyes avatar rkofman avatar wparad avatar

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.