diff --git a/API.md b/API.md index 2c847d2..9295c51 100644 --- a/API.md +++ b/API.md @@ -4,12 +4,6 @@
object
Lightweight, effecient and modular ES6 version of tween.js
object
Events class
-object
Tween Lite main constructor
-object
Timeline main constructor.
It works same as Tween
instance, using .repeat
, .restart
or etc
works like a Tween
, so please see Tween
class for methods
object
-Events class
-
-**Kind**: global namespace
-**Example**
-```js
-let ev = new EventClass()
ev.on('listen', name => `Hello ${name}`)
ev.emit('listen', 'World')
-```
-
-* [EventClass](#EventClass) : object
- * [.on(event, callback)](#EventClass+on)
- * [.once(event, callback)](#EventClass+once)
- * [.off(event, callback)](#EventClass+off)
- * [.emit(event)](#EventClass+emit)
-
-
-
-### eventClass.on(event, callback)
-Adds `event` to Events system
-
-**Kind**: instance method of [EventClass
](#EventClass)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| event | string
| Event listener name |
-| callback | function
| Event listener callback |
-
-
-
-### eventClass.once(event, callback)
-Adds `event` to Events system.
Removes itself after fired once
-
-**Kind**: instance method of [EventClass
](#EventClass)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| event | string
| Event listener name |
-| callback | function
| Event listener callback |
-
-
-
-### eventClass.off(event, callback)
-Removes `event` from Events system
-
-**Kind**: instance method of [EventClass
](#EventClass)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| event | string
| Event listener name |
-| callback | function
| Event listener callback |
-
-
-
-### eventClass.emit(event)
-Emits/Fired/Trigger `event` from Events system listeners
-
-**Kind**: instance method of [EventClass
](#EventClass)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| event | string
| Event listener name |
-
-
-
-## Lite : object
-Tween Lite main constructor
-
-**Kind**: global namespace
-
-| Param | Type | Description |
-| --- | --- | --- |
-| object | object
| initial object |
-
-**Example**
-```js
-import {Tween} from 'es6-tween/src/Tween.Lite'
let tween = new Tween({x:0}).to({x:100}, 2000).start()
-```
-
-* [Lite](#Lite) : object
- * [.onStart(callback)](#Lite+onStart)
- * [.onUpdate(callback)](#Lite+onUpdate)
- * [.onComplete(callback)](#Lite+onComplete)
- * [.isPlaying()](#Lite+isPlaying) ⇒ boolean
- * [.isStarted()](#Lite+isStarted) ⇒ boolean
- * [.pause()](#Lite+pause)
- * [.play()](#Lite+play)
- * [.duration(amount)](#Lite+duration)
- * [.to(properties, [duration])](#Lite+to)
- * [.start(time)](#Lite+start)
- * [.stop()](#Lite+stop)
- * [.delay(amount)](#Lite+delay)
- * [.repeat(amount)](#Lite+repeat)
- * [.reverseDelay(amount)](#Lite+reverseDelay)
- * [.yoyo(state)](#Lite+yoyo)
- * [.easing(_easingFunction)](#Lite+easing)
- * [.interpolation(_interpolationFunction)](#Lite+interpolation)
- * [.update(time, [preserve])](#Lite+update)
-
-
-
-### lite.onStart(callback)
-onStart callback
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| callback | function
| Function should be fired after tween is started |
-
-**Example**
-```js
-tween.onStart(object => console.log(object))
-```
-
-
-### lite.onUpdate(callback)
-onUpdate callback
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| callback | function
| Function should be fired while tween is in progress |
-
-**Example**
-```js
-tween.onUpdate(object => console.log(object))
-```
-
-
-### lite.onComplete(callback)
-onComplete callback
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| callback | function
| Function should be fired after tween is finished |
-
-**Example**
-```js
-tween.onComplete(object => console.log(object))
-```
-
-
-### lite.isPlaying() ⇒ boolean
-**Kind**: instance method of [Lite
](#Lite)
-**Returns**: boolean
- State of playing of tween
-**Example**
-```js
-tween.isPlaying() // returns `true` if tween in progress
-```
-
-
-### lite.isStarted() ⇒ boolean
-**Kind**: instance method of [Lite
](#Lite)
-**Returns**: boolean
- State of started of tween
-**Example**
-```js
-tween.isStarted() // returns `true` if tween in started
-```
-
-
-### lite.pause()
-Pauses tween
-
-**Kind**: instance method of [Lite
](#Lite)
-**Example**
-```js
-tween.pause()
-```
-
-
-### lite.play()
-Play/Resume the tween
-
-**Kind**: instance method of [Lite
](#Lite)
-**Example**
-```js
-tween.play()
-```
-
-
-### lite.duration(amount)
-Sets tween duration
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| amount | number
| Duration is milliseconds |
-
-**Example**
-```js
-tween.duration(2000)
-```
-
-
-### lite.to(properties, [duration])
-Sets target value and duration
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| properties | object
| | Target value (to value) |
-| [duration] | number
| 1000
| Duration of tween |
-
-**Example**
-```js
-new Tween({x:0}).to({x:200}, 2000)
-```
-
-
-### lite.start(time)
-Start the tweening
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| time | number
| setting manual time instead of Current browser timestamp |
-
-**Example**
-```js
-tween.start()
-```
-
-
-### lite.stop()
-Stops the tween
-
-**Kind**: instance method of [Lite
](#Lite)
-**Example**
-```js
-tween.stop()
-```
-
-
-### lite.delay(amount)
-Set delay of tween
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| amount | number
| Sets tween delay / wait duration |
-
-**Example**
-```js
-tween.delay(500)
-```
-
-
-### lite.repeat(amount)
-Sets how times tween is repeating
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| amount | amount
| the times of repeat |
-
-**Example**
-```js
-tween.repeat(2)
-```
-
-
-### lite.reverseDelay(amount)
-Set delay of each repeat alternate of tween
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| amount | number
| Sets tween repeat alternate delay / repeat alternate wait duration |
-
-**Example**
-```js
-tween.reverseDelay(500)
-```
-
-
-### lite.yoyo(state)
-Set `yoyo` state (enables reverse in repeat)
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| state | boolean
| Enables alternate direction for repeat |
-
-**Example**
-```js
-tween.yoyo(true)
-```
-
-
-### lite.easing(_easingFunction)
-Set easing
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| _easingFunction | function
| Easing function |
-
-**Example**
-```js
-tween.easing(Easing.Quadratic.InOut)
-```
-
-
-### lite.interpolation(_interpolationFunction)
-Set interpolation
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| _interpolationFunction | function
| Interpolation function |
-
-**Example**
-```js
-tween.interpolation(Interpolation.Bezier)
-```
-
-
-### lite.update(time, [preserve])
-Updates initial object to target value by given `time`
-
-**Kind**: instance method of [Lite
](#Lite)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| time | Time
| Current time |
-| [preserve] | boolean
| Prevents from removing tween from store |
-
-**Example**
-```js
-tween.update(500)
-```
## Timeline : object
@@ -666,7 +315,7 @@ tl.add(new Tween(node, {x:0}).to({x:200}, 200))
Tween main constructor
**Kind**: global namespace
-**Extends**: [EventClass
](#EventClass)
+**Extends**: [Tween
](#Tween)
| Param | Type | Description |
| --- | --- | --- |
@@ -680,6 +329,11 @@ let tween = new Tween(myNode, {width:'100px'}).to({width:'300px'}, 2000).start()
* [Tween](#Tween) : object
* _instance_
+ * [.setMaxListener(count)](#Tween+setMaxListener)
+ * [.on(event, callback)](#Tween+on)
+ * [.once(event, callback)](#Tween+once)
+ * [.off(event, callback)](#Tween+off)
+ * [.emit(event)](#Tween+emit)
* [.isPlaying()](#Tween+isPlaying) ⇒ boolean
* [.isStarted()](#Tween+isStarted) ⇒ boolean
* [.reverse([state])](#Tween+reverse)
@@ -693,16 +347,76 @@ let tween = new Tween(myNode, {width:'100px'}).to({width:'300px'}, 2000).start()
* [.start(time)](#Tween+start)
* [.stop()](#Tween+stop)
* [.delay(amount)](#Tween+delay)
+ * [.chainedTweens(arguments)](#Tween+chainedTweens)
* [.repeat(amount)](#Tween+repeat)
* [.reverseDelay(amount)](#Tween+reverseDelay)
* [.yoyo(state, [_easingReverse])](#Tween+yoyo)
* [.easing(_easingFunction)](#Tween+easing)
+ * [.interpolation(_interpolationFunction)](#Tween+interpolation)
* [.update(time, [preserve], [forceTime])](#Tween+update)
* _static_
* [.fromTo(node, object, to, params)](#Tween.fromTo)
* [.to(node, to, params)](#Tween.to)
* [.from(node, from, params)](#Tween.from)
+
+
+### tween.setMaxListener(count)
+Sets max `event` listener's count to Events system
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| count | number
| Event listener's count |
+
+
+
+### tween.on(event, callback)
+Adds `event` to Events system
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| event | string
| Event listener name |
+| callback | function
| Event listener callback |
+
+
+
+### tween.once(event, callback)
+Adds `event` to Events system.
Removes itself after fired once
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| event | string
| Event listener name |
+| callback | function
| Event listener callback |
+
+
+
+### tween.off(event, callback)
+Removes `event` from Events system
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| event | string
| Event listener name |
+| callback | function
| Event listener callback |
+
+
+
+### tween.emit(event)
+Emits/Fired/Trigger `event` from Events system listeners
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| event | string
| Event listener name |
+
### tween.isPlaying() ⇒ boolean
@@ -869,6 +583,21 @@ Set delay of tween
```js
tween.delay(500)
```
+
+
+### tween.chainedTweens(arguments)
+Chained tweens
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| arguments | any
| Arguments list |
+
+**Example**
+```js
+tween.chainedTweens(tween1, tween2)
+```
### tween.repeat(amount)
@@ -930,6 +659,21 @@ Set easing
```js
tween.easing(Easing.Elastic.InOut)
```
+
+
+### tween.interpolation(_interpolationFunction)
+Set interpolation
+
+**Kind**: instance method of [Tween
](#Tween)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| _interpolationFunction | function
| Interpolation function |
+
+**Example**
+```js
+tween.interpolation(Interpolation.Bezier)
+```
### tween.update(time, [preserve], [forceTime])
diff --git a/README.md b/README.md
index 27c4d75..1f5b1c1 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,6 @@ ES6 implementation of tween.js
[![size](http://img.badgesize.io/http://unpkg.com/es6-tween?cache=false)](http://unpkg.com/es6-tween)
[![gzipsize](http://img.badgesize.io/http://unpkg.com/es6-tween?compression=gzip&cache=false)](http://unpkg.com/es6-tween)
-[![size-lite](http://img.badgesize.io/http://unpkg.com/es6-tween/lite/Tween.min.js?label=lite%20size&cache=false)](http://unpkg.com/es6-tween/lite/Tween.min.js)
-[![gzipsize-lite](http://img.badgesize.io/http://unpkg.com/es6-tween/lite/Tween.min.js?compression=gzip&cache=false&label=lite%20gzip%20size)](http://unpkg.com/es6-tween/lite/Tween.min.js)
[![CDNJS](https://img.shields.io/cdnjs/v/es6-tween.svg)](https://cdnjs.com/libraries/es6-tween)
[![jsdelivr](https://img.shields.io/badge/cdn-jsdelivr-brightgreen.svg)](https://cdn.jsdelivr.net/npm/es6-tween) [![unpkg](https://img.shields.io/badge/cdn-unpkg-brightgreen.svg)](https://unpkg.com/es6-tween) [![npmcdn](https://img.shields.io/badge/cdn-npmcdn-brightgreen.svg)](https://npmcdn.com/es6-tween)
[![NPM Version][npm-image]][npm-url]
@@ -29,33 +27,6 @@ let tween = new TWEEN.Tween(coords)
```
-# Adversiting
-* Backers will be show there
-* The user @dalisoft is looking for job, you can contact to me via [e-mail](mailto:dalisoft@mail.ru), or at [Twitter](https://twitter.com/dalisoft)
-
-
-# `Lite` version
-
-You can use the `Lite` version of ES6 which lighter (~9Kb minified, ~3Kb min&gzip), faster (~10% faster execution speed), simpler (like the original one), memory effecient and better (can tween second-level Objects/Array). Optimized for runtime performance, no-lag anymore.
-When you want building mobile apps that loading files from server, use `Lite` for better performance.
-Differences when using `Lite`:
-
-* 2-times lighter size
-* No `Timeline` instance
-* No `String` tween support
-* No `Deep tween` support (does 2-level)
-* Uses original `Interpolation` instances for `Bezier` interpolation
-* Faster performance and execution speed
-* Memory effecient
-* No more shims required
-* No `Plugins` support
-* No `DOM Get/Set`, `Renderer` instance/plugin/add-on support
-* No full-Event system, just 3 event support (`onStart`, `onUpdate`, `onComplete`)
-* No `seek`, `reverse`, `restart` support
-* No event fire when `stop`, `pause`, `etc`
-* No `*`, `/`, `%` relatives support
-
-
## Plugins
Starting at `v3`, we provide excluded plugins from core, so our core becomes lighter and faster. [Here our plugins list](https://www.npmjs.com/browse/keyword/es6-tween)
@@ -80,32 +51,19 @@ Download the [library](https://raw.githubusercontent.com/tweenjs/es6-tween/maste
* See [cdnjs-hosted version](https://cdnjs.com/libraries/es6-tween) 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 both version `Full` and `Lite`
+* Now you can load from CDN
```html
-
-
-
-
-
-
-
-
-
-
-
-
-
```
@@ -135,19 +93,11 @@ import { Easing, Interpolation, Tween, autoPlay } from 'es6-tween/src/index.lite
```
@@ -164,11 +114,7 @@ $ bower install es6-tween
Then include the Tween.js module with the standard node.js `require`:
```javascript
-// Full
const { Tween, Easing, autoPlay } = require('es6-tween');
-
-// Lite
-const { Tween, Interpolation, Easing, autoPlay } = require('es6-tween/lite/Tween');
```
And you can use Tween.js as in all other examples--for example:
diff --git a/examples/basic.html b/examples/basic.html
index c99c3a6..dc5137a 100644
--- a/examples/basic.html
+++ b/examples/basic.html
@@ -22,26 +22,28 @@
-
-
-
-
-
-
+
+
+
+