Skip to content

Commit 7e4779b

Browse files
committed
* fixes: package main file now give unminified bundle
* fixes: removed ununsed method from `lite` * fixes: fixed `repeat`, `reassignValue` and some methods on Full version * and some minor fixes and tiny improvements with tiny file reduce for `Lite`...
1 parent c528292 commit 7e4779b

File tree

6 files changed

+22
-28
lines changed

6 files changed

+22
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Differences when using `Lite`:
5151
* No `Plugins` support
5252
* No `DOM Get/Set`, `Renderer` instance/plugin/add-on support
5353
* No full-Event system, just 3 event support (`onStart`, `onUpdate`, `onComplete`)
54-
* No `seek`, `reverse` support
54+
* No `seek`, `reverse`, `restart` support
5555
* No event fire when `stop`, `pause`, `etc`
5656
* No `*`, `/`, `%` relatives support
5757

jsdoc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"monospaceLinks": true
1717
},
1818
"opts": {
19-
"destination": "../es6-tween-gh/",
19+
"destination": "../es6-tween-gh/docs/",
2020
"encoding": "utf8",
2121
"private": true,
2222
"recurse": true,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "es6-tween",
3-
"version": "3.8.16",
3+
"version": "3.8.18",
44
"description": "ES6 implementation of amazing tween.js",
55
"browser": "full/Tween.min.js",
66
"cdn": "full/Tween.min.js",
7-
"main": "full/Tween.min.js",
7+
"main": "full/Tween.js",
88
"module": "src/index.js",
99
"directories": {
1010
"example": "examples"

ts/Tween.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,9 @@ class Tween extends EventClass {
238238
*/
239239
public restart(noDelay?: boolean) {
240240
this._repeat = this._r
241-
this._startTime = now() + (noDelay ? 0 : this._delayTime)
241+
this.reassignValues()
242242

243-
if (!this._isPlaying) {
244-
add(this)
245-
}
243+
add(this)
246244

247245
return this.emit(EVENT_RS, this.object)
248246
}
@@ -257,6 +255,9 @@ class Tween extends EventClass {
257255
public seek(time: number, keepPlaying?: boolean) {
258256
this._startTime = now() + Math.max(0, Math.min(
259257
time, this._duration))
258+
this._isPlaying = true
259+
260+
add(this)
260261

261262
this.emit(EVENT_SEEK, time, this.object)
262263

@@ -365,12 +366,13 @@ class Tween extends EventClass {
365366
public stop() {
366367
const {
367368
_isPlaying,
369+
_isFinite,
368370
object,
369371
_startTime,
370372
_duration
371373
} = this
372374

373-
if (!_isPlaying) {
375+
if (!_isPlaying || !_isFinite) {
374376
return this
375377
}
376378

@@ -463,7 +465,7 @@ class Tween extends EventClass {
463465
* @private
464466
* @memberof Tween
465467
*/
466-
public reassignValues(time) {
468+
public reassignValues(time?: number) {
467469
const {
468470
_valuesFunc,
469471
object,
@@ -473,6 +475,7 @@ class Tween extends EventClass {
473475
this._isPlaying = true
474476
this._startTime = time !== undefined ? time : now()
475477
this._startTime += _delayTime
478+
this._reversed = false
476479
add(this)
477480

478481
const _valuesStart: any = _valuesFunc(0)

ts/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ let frameMs: number = 50 / 3
6363
* TWEEN.add(tween)
6464
*/
6565
const add = (tween: any): void => {
66+
let i: number = _tweens.indexOf(tween)
67+
68+
if (i > -1) {
69+
_tweens.splice(i, 1)
70+
}
71+
6672
_tweens.push(tween)
6773

6874
if (_autoPlay && !isStarted) {

ts/lite.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ class Lite {
280280
public stop() {
281281
const {
282282
_isPlaying,
283+
_isFinite,
283284
_startTime,
284285
_duration
285286
} = this
286287

287-
if (!_isPlaying) {
288+
if (!_isPlaying || !_isFinite) {
288289
return this
289290
}
290291

@@ -386,22 +387,6 @@ class Lite {
386387
return this
387388
}
388389

389-
public reassignValues() {
390-
const {
391-
_valuesStart,
392-
_valuesEnd,
393-
object
394-
} = this
395-
396-
for (const property in _valuesEnd) {
397-
const start = _valuesStart[property]
398-
399-
object[property] = start
400-
}
401-
402-
return this
403-
}
404-
405390
/**
406391
* Updates initial object to target value by given `time`
407392
* @param {Time} time Current time
@@ -500,9 +485,9 @@ class Lite {
500485
return true
501486
} else {
502487
if (!preserve) {
488+
this._isPlaying = false
503489
remove(this)
504490
}
505-
this._isPlaying = false
506491
if (_onCompleteCallback) {
507492
_onCompleteCallback()
508493
}

0 commit comments

Comments
 (0)