Skip to content

Commit 17a67ee

Browse files
committed
* Stable version publish
1 parent 03f92c5 commit 17a67ee

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ES6 implementation of <a href="https://github.com/tweenjs/tween.js">tween.js</a>
1111
let coords = { x: 0, y: 0 };
1212
let tween = new TWEEN.Tween(coords)
1313
.to({ x: 100, y: 100 }, 1000)
14-
.onUpdate(object => {
14+
.on('update', object => {
1515
console.log(object.x, object.y);
1616
})
1717
.start();

docs/user_guide.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This will take care of updating all active tweens; after 1 second (i.e. 1000 mil
5050
But unless you print the value of `x` to the console, you can't see its value changing. You might want to use the `onUpdate` callback:
5151

5252
````javascript
53-
tween.emit('update', (object) => {
53+
tween.on('update', (object) => {
5454
console.log(object.x);
5555
});
5656
````
@@ -288,7 +288,7 @@ let trickyObjTween = new TWEEN.Tween({
288288
propertyB: trickyObj.getPropertyB()
289289
})
290290
.to({ propertyA: 100, propertyB: 200 })
291-
.emit('update', (object) => {
291+
.on('update', (object) => {
292292
object.setA( object.propertyA );
293293
object.setB( object.propertyB );
294294
});
@@ -299,29 +299,29 @@ Or imagine you want to play a sound when a tween is started. You can use an `sta
299299
````javascript
300300
let tween = new TWEEN.Tween(obj)
301301
.to({ x: 100 })
302-
.emit('start', () => {
302+
.once('start', () => {
303303
sound.play();
304304
});
305305
````
306306

307307
The scope for each callback is the tweened object--in this case, `obj`.
308308

309-
### emit
309+
### Events
310310

311-
In ES6 implementation we try to use `emit` similar to `node.js` `emit` events, but easier to use. This way extends flexibility over tweens and reduces size as well. With `emit` method, callback isn't limitation anymore, even you can extend events
311+
In ES6 implementation we try to use `on`, `once` and `emit` similar to `node.js` `emit` events, but easier to use. This way extends flexibility over tweens and reduces size as well. With `event` methods, callback isn't limitation anymore, even you can extend events
312312

313313
```javascript
314-
tween.emit('start', (object) => {
314+
tween.once('start', (object) => {
315315
console.log('start called');
316316
});
317317
// 'start' calls when tween starts
318318

319-
tween.emit('completed_my_tween', (sureArg) => {
319+
tween.once('completed_my_tween', (sureArg) => {
320320
console.log('tween is really ' + (sureArg ? 'completed' : 'incompleted'));
321321
});
322322

323-
tween.emit('complete', function () {
324-
tween.emit('completed', !this._isPlaying);
323+
tween.once('complete', function () {
324+
tween.emit('completed_my_tween', !this._isPlaying);
325325
});
326326

327327
```
@@ -405,7 +405,7 @@ When you try to animate the position of an element in the page, the easiest solu
405405
let element = document.getElementById('myElement');
406406
let tween = new TWEEN.Tween({ top: 0, left: 0 })
407407
.to({ top: 100, left: 100 }, 1000)
408-
.emit('update', (object) => {
408+
.on('update', (object) => {
409409
element.style.top = object.top + 'px';
410410
element.style.left = object.left + 'px';
411411
});
@@ -417,7 +417,7 @@ but this is really inefficient because altering these properties forces the brow
417417
let element = document.getElementById('myElement');
418418
let tween = new TWEEN.Tween({ top: 0, left: 0 })
419419
.to({ top: 100, left: 100 }, 1000)
420-
.emit('update', (object) => {
420+
.on('update', (object) => {
421421
element.style.transform = 'translate(' + object.left + 'px, ' + object.top + 'px);';
422422
});
423423
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "es6-tween",
3-
"version": "0.1.10",
3+
"version": "1.0.0",
44
"description": "ES6 implementation of amazing tween.js",
55
"main": "dist/Tween.js",
66
"directories": {

0 commit comments

Comments
 (0)