1- import { CSS , rafFrames , raf , transitionEnd } from '../util/dom' ;
1+ import { CSS , rafFrames , transitionEnd } from '../util/dom' ;
22import { assign , isDefined } from '../util/util' ;
33
44
@@ -7,25 +7,25 @@ import {assign, isDefined} from '../util/util';
77 **/
88export class Animation {
99 private _parent : Animation ;
10- private _c : Array < Animation > ;
11- private _el : Array < HTMLElement > ;
10+ private _c : Animation [ ] ;
11+ private _el : HTMLElement [ ] ;
1212 private _opts : AnimationOptions ;
1313 private _fx : { [ key : string ] : EffectProperty } ;
1414 private _dur : number ;
1515 private _easing : string ;
16- private _bfSty : any ;
17- private _bfAdd : Array < string > ;
18- private _bfRmv : Array < string > ;
19- private _afSty : any ;
20- private _afAdd : Array < string > ;
21- private _afRmv : Array < string > ;
22- private _pFns : Array < Function > ;
23- private _fFns : Array < Function > ;
24- private _fOnceFns : Array < Function > ;
16+ private _bfSty : { [ property : string ] : any ; } ;
17+ private _bfAdd : string [ ] ;
18+ private _bfRmv : string [ ] ;
19+ private _afSty : { [ property : string ] : any ; } ;
20+ private _afAdd : string [ ] ;
21+ private _afRmv : string [ ] ;
22+ private _pFns : Function [ ] ;
23+ private _fFns : Function [ ] ;
24+ private _fOnceFns : Function [ ] ;
2525 private _wChg : boolean = false ;
2626 private _rv : boolean ;
2727 private _unregTrans : Function ;
28- private _tmr : any ;
28+ private _tmr : number ;
2929 private _lastUpd : number = 0 ;
3030
3131 public isPlaying : boolean ;
@@ -63,7 +63,7 @@ export class Animation {
6363 }
6464
6565 element ( ele : any ) : Animation {
66- var i ;
66+ var i : number ;
6767
6868 if ( ele ) {
6969 if ( Array . isArray ( ele ) ) {
@@ -133,7 +133,7 @@ export class Animation {
133133 }
134134
135135 to ( prop : string , val : any , clearProperyAfterTransition ?: boolean ) : Animation {
136- var fx = this . _addProp ( 'to' , prop , val ) ;
136+ var fx : EffectProperty = this . _addProp ( 'to' , prop , val ) ;
137137
138138 if ( clearProperyAfterTransition ) {
139139 // if this effect is a transform then clear the transform effect
@@ -149,7 +149,7 @@ export class Animation {
149149 }
150150
151151 private _addProp ( state : string , prop : string , val : any ) : EffectProperty {
152- var fxProp = this . _fx [ prop ] ;
152+ var fxProp : EffectProperty = this . _fx [ prop ] ;
153153
154154 if ( ! fxProp ) {
155155 // first time we've see this EffectProperty
@@ -208,11 +208,11 @@ export class Animation {
208208 this . _bfRmv . push ( className ) ;
209209 return this ;
210210 } ,
211- setStyles : ( styles : any ) : Animation => {
211+ setStyles : ( styles : { [ property : string ] : any ; } ) : Animation => {
212212 this . _bfSty = styles ;
213213 return this ;
214214 } ,
215- clearStyles : ( propertyNames : Array < string > ) : Animation => {
215+ clearStyles : ( propertyNames : string [ ] ) : Animation => {
216216 for ( var i = 0 ; i < propertyNames . length ; i ++ ) {
217217 this . _bfSty [ propertyNames [ i ] ] = '' ;
218218 }
@@ -231,11 +231,11 @@ export class Animation {
231231 this . _afRmv . push ( className ) ;
232232 return this ;
233233 } ,
234- setStyles : ( styles : any ) : Animation => {
234+ setStyles : ( styles : { [ property : string ] : any ; } ) : Animation => {
235235 this . _afSty = styles ;
236236 return this ;
237237 } ,
238- clearStyles : ( propertyNames : Array < string > ) : Animation => {
238+ clearStyles : ( propertyNames : string [ ] ) : Animation => {
239239 for ( var i = 0 ; i < propertyNames . length ; i ++ ) {
240240 this . _afSty [ propertyNames [ i ] ] = '' ;
241241 }
@@ -246,7 +246,7 @@ export class Animation {
246246
247247 play ( opts : PlayOptions = { } ) {
248248 var self = this ;
249- var i ;
249+ var i : number ;
250250 var duration = isDefined ( opts . duration ) ? opts . duration : self . _dur ;
251251
252252 console . debug ( 'Animation, play, duration' , duration , 'easing' , self . _easing ) ;
@@ -386,7 +386,12 @@ export class Animation {
386386
387387 _progress ( stepValue : number ) {
388388 // bread 'n butter
389- var i , prop , fx , val , transforms , tweenEffect ;
389+ var i : number ;
390+ var prop : string ;
391+ var fx : EffectProperty ;
392+ var val : any ;
393+ var transforms : string [ ] ;
394+ var tweenEffect : boolean ;
390395
391396 for ( i = 0 ; i < this . _c . length ; i ++ ) {
392397 this . _c [ i ] . _progress ( stepValue ) ;
@@ -457,7 +462,8 @@ export class Animation {
457462 }
458463
459464 _setTrans ( duration : number , forcedLinearEasing : boolean ) {
460- var i , easing ;
465+ var i : number ;
466+ var easing : string ;
461467
462468 // set the TRANSITION properties inline on the element
463469 for ( i = 0 ; i < this . _c . length ; i ++ ) {
@@ -479,7 +485,9 @@ export class Animation {
479485 }
480486
481487 _willChange ( addWillChange : boolean ) {
482- var i , wc , prop ;
488+ var i : number ;
489+ var wc : string [ ] ;
490+ var prop : string ;
483491
484492 for ( i = 0 ; i < this . _c . length ; i ++ ) {
485493 this . _c [ i ] . _willChange ( addWillChange ) ;
@@ -505,7 +513,10 @@ export class Animation {
505513 _before ( ) {
506514 // before the RENDER_DELAY
507515 // before the animations have started
508- var i , j , prop , ele ;
516+ var i : number ;
517+ var j : number ;
518+ var prop : string ;
519+ var ele : HTMLElement ;
509520
510521 // stage all of the child animations
511522 for ( i = 0 ; i < this . _c . length ; i ++ ) {
@@ -536,7 +547,10 @@ export class Animation {
536547
537548 _after ( ) {
538549 // after the animations have finished
539- var i , j , prop , ele ;
550+ var i : number ;
551+ var j : number ;
552+ var prop : string ;
553+ var ele : HTMLElement ;
540554
541555 for ( i = 0 ; i < this . _c . length ; i ++ ) {
542556 this . _c [ i ] . _after ( ) ;
@@ -673,7 +687,7 @@ export class Animation {
673687
674688 _onFinish ( hasCompleted : boolean ) {
675689 this . isPlaying = false ;
676- var i ;
690+ var i : number ;
677691
678692 for ( i = 0 ; i < this . _fFns . length ; i ++ ) {
679693 this . _fFns [ i ] ( hasCompleted ) ;
@@ -693,7 +707,8 @@ export class Animation {
693707 }
694708
695709 destroy ( removeElement ?: boolean ) {
696- var i , ele ;
710+ var i : number ;
711+ var ele : HTMLElement ;
697712
698713 for ( i = 0 ; i < this . _c . length ; i ++ ) {
699714 this . _c [ i ] . destroy ( removeElement ) ;
@@ -711,7 +726,8 @@ export class Animation {
711726
712727 _transEl ( ) : HTMLElement {
713728 // get the lowest level element that has an Animation
714- var i , targetEl ;
729+ var i : number ;
730+ var targetEl : HTMLElement ;
715731
716732 for ( i = 0 ; i < this . _c . length ; i ++ ) {
717733 targetEl = this . _c [ i ] . _transEl ( ) ;
0 commit comments