@@ -49,9 +49,7 @@ export interface RenderType {
4949class  Tween  extends  EventClass  { 
5050  public  id : number 
5151  public  object : Object 
52-   public  _valuesStart : Object 
53-   public  _valuesFunc : Object 
54-   public  _valuesEnd : Object 
52+   public  _valuesEnd : any 
5553  public  _duration : number 
5654  public  _easingFunction : Function 
5755  public  _easingReverse : Function 
@@ -69,7 +67,6 @@ class Tween extends EventClass {
6967  public  _isFinite : boolean 
7068  public  _isPlaying : boolean 
7169  public  _elapsed : number 
72-   public  isArr : boolean 
7370  private  _onStartCallbackFired : boolean 
7471  private  _rendered : boolean 
7572  private  __render : RenderType 
@@ -133,10 +130,7 @@ class Tween extends EventClass {
133130        this . object  =  object 
134131      } 
135132    } 
136-     const  isArr  =  this . isArr  =  Array . isArray ( object ) 
137-     this . _valuesStart  =  isArr  ? [ ]  : { } 
138133    this . _valuesEnd  =  null 
139-     this . _valuesFunc  =  { } 
140134
141135    this . _duration  =  1000 
142136    this . _easingFunction  =  defaultEasing 
@@ -313,53 +307,33 @@ class Tween extends EventClass {
313307   */ 
314308  public  render ( )  { 
315309    if  ( this . _rendered )  { 
316-       return  this 
310+       return  this ; 
317311    } 
318- 
319-     let  { 
320-       _valuesEnd, 
321-       _valuesFunc, 
322-       _valuesStart, 
323-       object, 
324-       Renderer, 
325-       node, 
326-       InitialValues
327-     }  =  this 
328- 
312+     let  {  _valuesEnd,  object,  Renderer,  node,  InitialValues,  _easingFunction }  =  this ; 
329313    if  ( node  &&  InitialValues )  { 
330314      if  ( ! object )  { 
331-         object  =  this . object  =  NodeCache ( node ,  InitialValues ( node ,  _valuesEnd ) ) 
332-       }  else  if  ( ! _valuesEnd )  { 
333-         _valuesEnd  =  this . _valuesEnd  =  InitialValues ( node ,  object ) 
315+         object  =  this . object  =  NodeCache ( node ,  InitialValues ( node ,  _valuesEnd ) ) ; 
316+       } 
317+       else  if  ( ! _valuesEnd )  { 
318+         _valuesEnd  =  this . _valuesEnd  =  InitialValues ( node ,  object ) ; 
334319      } 
335320    } 
336- 
337321    for  ( const  property  in  _valuesEnd )  { 
338-       const  start  =  object  &&  object [ property ] 
339-       const  end  =  _valuesEnd [ property ] 
340- 
322+       const  start  =  object  &&  object [ property ] ; 
323+       const  end  =  _valuesEnd [ property ] ; 
341324      if  ( Plugins [ property ] )  { 
342-         const  plugin  =  Plugins [ property ] . prototype . update  ? new  Plugins [ property ] ( this ,  start ,  end ,  property ,  object )  : Plugins [ property ] ( this ,  start ,  end ,  property ,  object ) 
325+         const  plugin  =  Plugins [ property ] . prototype . update  ? new  Plugins [ property ] ( this ,  start ,  end ,  property ,  object )  : Plugins [ property ] ( this ,  start ,  end ,  property ,  object ) ; 
343326        if  ( plugin )  { 
344-           _valuesFunc [ property ]  =  plugin 
327+           _valuesEnd [ property ]  =  plugin ; 
345328        } 
346-         continue 
347-       } 
348- 
349-       if  ( ! object  ||  object [ property ]  ===  undefined )  { 
350-         continue 
351-       } 
352- 
353-       if  ( typeof  end  ===  'number'  &&  typeof  start  ===  'number' )  { 
354-         _valuesStart [ property ]  =  start 
355-         _valuesEnd [ property ]  =  end 
356-       }  else  { 
357-         _valuesFunc [ property ]  =  InterTween ( start ,  end ) 
329+         continue ; 
358330      } 
359331    } 
360332
333+     this . _valuesEnd  =  InterTween ( object ,  _valuesEnd ,  null ,  _easingFunction ) 
334+ 
361335    if  ( Renderer  &&  this . node )  { 
362-       this . __render  =  new  Renderer ( this ,  object ,  _valuesEnd ) 
336+       this . __render  =  new  Renderer ( this ,  object ,  _valuesEnd ) ; 
363337    } 
364338
365339    return  this 
@@ -491,22 +465,17 @@ class Tween extends EventClass {
491465   */ 
492466  public  reassignValues ( )  { 
493467    const  { 
494-       _valuesStart, 
495468      _valuesEnd, 
496-       object, 
497-       isArr
469+       object
498470    }  =  this 
499471
500-     let  property : any 
501-     for  ( property  in  _valuesEnd )  { 
502-       if  ( isArr )  { 
503-         property  =  parseInt ( property ) 
504-       } 
472+     const  _valuesStart : any  =  _valuesEnd ( 0 ) 
473+ 
474+     for  ( const  property  in  _valuesStart )  { 
505475
506476      const  start  =  _valuesStart [ property ] 
507-       const  end  =  _valuesEnd [ property ] 
508477
509-       object [ property ]  =  typeof   end   ===   'function'  ?  end ( 0 )  :  start 
478+       object [ property ]  =  start 
510479    } 
511480
512481    return  this 
@@ -520,7 +489,7 @@ class Tween extends EventClass {
520489   * @memberof  Tween 
521490   */ 
522491  public  update ( time : number ,  preserve ?: boolean )  { 
523-     const  { 
492+     let  { 
524493      _onStartCallbackFired, 
525494      _easingFunction, 
526495      _easingReverse, 
@@ -531,19 +500,15 @@ class Tween extends EventClass {
531500      _reversed, 
532501      _startTime, 
533502      _duration, 
534-       _valuesStart, 
535503      _valuesEnd, 
536-       _valuesFunc, 
537504      object, 
538505      _isFinite, 
539506      _isPlaying, 
540507      __render
541508    }  =  this 
542509
543-     let  elapsed 
544-     let  value 
545-     let  property 
546-     let  currentEasing 
510+     let  elapsed : number 
511+     let  currentEasing : Function 
547512
548513    time  =  time  !==  undefined  ? time  : now ( ) 
549514
@@ -555,6 +520,7 @@ class Tween extends EventClass {
555520      if  ( ! this . _rendered )  { 
556521        this . render ( ) 
557522        this . _rendered  =  true 
523+         _valuesEnd  =  this . _valuesEnd 
558524      } 
559525
560526      this . emit ( EVENT_START ,  object ) 
@@ -568,27 +534,11 @@ class Tween extends EventClass {
568534
569535    currentEasing  =  _reversed  ? _easingReverse  : _easingFunction 
570536
571-     if  ( ! object )  { 
537+     if  ( typeof   _valuesEnd   !==   'function'   ||   ! object )  { 
572538      return  true 
573539    } 
574540
575-     for  ( property  in  _valuesEnd )  { 
576-       value  =  currentEasing [ property ]  ? currentEasing [ property ] ( elapsed )  : typeof  currentEasing  ===  'function'  ? currentEasing ( elapsed )  : defaultEasing ( elapsed ) 
577- 
578-       const  start  =  _valuesStart [ property ] 
579-       const  end  =  _valuesEnd [ property ] 
580-       const  fnc  =  _valuesFunc [ property ] 
581- 
582-       if  ( fnc  &&  fnc . update )  { 
583-         fnc . update ( value ,  elapsed ) 
584-       }  else  if  ( fnc )  { 
585-         object [ property ]  =  fnc ( value ) 
586-       }  else  if  ( typeof  end  ===  'number' )  { 
587-         object [ property ]  =  start  +  ( end  -  start )  *  value 
588-       }  else  { 
589-         object [ property ]  =  end 
590-       } 
591-     } 
541+     _valuesEnd ( elapsed ,  elapsed ,  currentEasing ) 
592542
593543    if  ( __render )  { 
594544      __render . update ( object ,  elapsed ) 
0 commit comments