xes-rx-tween

[![Build Status](https://travis-ci.org/Xesenix/xes-rx-tween.svg?branch=master)](https://travis-ci.org/Xesenix/xes-rx-tween) [![Coverage Status](https://coveralls.io/repos/github/Xesenix/xes-rx-tween/badge.svg?branch=master)](https://coveralls.io/github/Xe

Usage no npm install needed!

<script type="module">
  import xesRxTween from 'https://cdn.skypack.dev/xes-rx-tween';
</script>

README

Build Status Coverage Status Greenkeeper badge bitHound Overall Score Known Vulnerabilities

Observable Tween with Rxjs

This library supplies you with observable for tweening over numbers.

Usage

Install

npm i xes-rx-tween

Basic usage example:

import { tweenObservable } from 'xes-rx-tween';

tweenObservable(2000, 0, 100)
    .subscribe((interpolationValue) => {
        // do some stuff with interpolationValue for example
        object.x = interpolationValue;
    })

You also can do some more stuff with tweened value for example use some tweening functions on them:

import { tweenObservable } from 'xes-rx-tween';

const easingFunction = (x) => Math.sin(x * Math.PI);

tweenObservable(2000, 1, 1.5)
    .map(easingFunction)
    .subscribe((interpolationValue) => {
        // do some stuff with interpolationValue for example
        object.scale = interpolationValue;
    })

Tests

Single run

npm run test

Watch mode

npm run test:watch