Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including es6-tween with all npm packages installed. Try it out:

var es6Tween = require("es6-tween")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

es6-tween v5.5.10

ES6 implementation of amazing tween.js

es6-tween

  • High-performant animations without headaches
  • Simple, modular and functional animation library for web and node
  • Tweening library that needs to use where performance matter
  • Flexible, extendable, modular and resource-efficient tweening library

NPM Min Size NPM Gzip Size CDNJS NPM Version NPM Downloads license Travis tests
NPM

Note

We already know what is tweening and why it's need, so there no need to describe it's, Google will do this if you want. This library is not made as alternative to another libraries, it's has own pros and cons

Docs

TWEEN.autoPlay(true); // simplify the your code

let coords = { x: 0, y: 0 };
let tween = new TWEEN.Tween(coords)
  .to({ x: 100, y: 100 }, 1000)
  .on('update', ({ x, y }) => {
    console.log(`The values is x: ${x} and y: ${y}`);
  })
  .start();

Plugins

Starting at v3, we provide excluded plugins from core, so our core becomes lighter and faster. Here our plugins list

Demos

Installation

Download the library and include it in your code:

<script src="bundled/Tween.js"></script>

CDN-Hosted version

  • See cdnjs-hosted version for get which result you want

  • NOTE: @latest suffix sometimes saves life by loading latest, because sometimes CDN services will not load the latest

  • Now you can load from CDN

<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/es6-tween"></script>

<!-- unpkg -->
<script src="https://unpkg.com/es6-tween"></script>

<!-- npmcdn -->
<script src="https://npmcdn.com/es6-tween"></script>

More advanced users might want to...

Using import

import { Easing, Tween, autoPlay } from 'es6-tween';

Using getlibs

<script src="https://unpkg.com/getlibs"></script>
<script type="x-module">
  // ES6
  import { Easing, Tween, autoPlay } from 'es6-tween'


  // CommonJS
  const { Tween, Easing, autoPlay } = require('es6-tween')
</script>

Using npm or yarn

$ yarn add es6-tween
# or
$ npm install es6-tween

Then include the Tween.js module with the standard node.js require:

const { Tween, Easing, autoPlay } = require('es6-tween');

And you can use Tween.js as in all other examples--for example:

const t = new Tween(/* etc */);
t.start();

You can run script commands to build modules into single UMD compatible file:

Using commands

$ yarn build # builds production files
# or
$ yarn dev # builds and watchs development files

Then reference the library source:

<script src="bundled/Tween.min.js"></script>

Features

  • Tweens everything you give them, string, number, number of arrays, number of object, all-to, interpolators and much more. Endless possibilites
  • Can use CSS units (e.g. appending px)
  • Can interpolate colours
  • Easing functions are reusable outside of Tween
  • Can also use custom easing functions
  • Much of easings

Compatiblity Testing

Thanks to BrowserStack for providing us testing in a real devices to make it cross-browser, bug-free and better. BrowserStack saved my countless hours, before i spent on testing much of time, now it's very easy. I recommend to others use this service. I sure, BrowserStack helps us to make it, so i am linking to BrowserStack as our sponsor. Browser Stack Logo

Tests

$ yarn test

or you can go here for more information, tests and etc...

every time you want to run the tests.

If you want to add any feature or change existing features, you must run the tests to make sure you didn't break anything else. If you send a PR to add something new and it doesn't have tests, or the tests don't pass, the PR won't be accepted. See contributing for more information.

People

Thanks to

these tools developers and to their community and without these tools maybe this library wouldn't be possible

Projects using es6-tween

It's great to see this library to be used in production and/or library, thank you!

If you have projects using es6-tween, please make issue or PR, i will add here your project too :)

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free