11import { AnimationKeyframe } from '@angular/core/src/animation/animation_keyframe' ;
22import { AnimationPlayer } from '@angular/core/src/animation/animation_player' ;
3- import { AnimationStyles } from '@angular/core/src/animation/animation_styles' ;
4- import { AnimationDriver } from '@angular/core/src/animation/animation_driver' ;
53import { KeyframeAnimation , KeyframeAnimationInfo , KeyframeInfo , KeyframeDeclaration } from 'ui/animation/keyframe-animation' ;
64import { View } from "ui/core/view" ;
75import enums = require( "ui/enums" ) ;
@@ -10,14 +8,14 @@ import observable = require('ui/core/dependency-observable');
108import types = require( "utils/types" ) ;
119
1210export class NativeScriptAnimationPlayer implements AnimationPlayer {
13-
11+
1412 public parentPlayer : AnimationPlayer ;
1513
1614 private _subscriptions : Function [ ] = [ ] ;
1715 private _finished = false ;
1816 private animation : KeyframeAnimation ;
1917 private target : View ;
20-
18+
2119 constructor ( element : Node , keyframes : AnimationKeyframe [ ] , duration : number , delay : number , easing : string ) {
2220
2321 this . parentPlayer = null ;
@@ -52,14 +50,14 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
5250 if ( typeof value === "string" && property . valueConverter ) {
5351 value = property . valueConverter ( < string > value ) ;
5452 }
55- keyframeInfo . declarations . push ( { property : property . name , value : value } )
53+ keyframeInfo . declarations . push ( { property : property . name , value : value } ) ;
5654 }
5755 else if ( typeof value === "string" && substyle === "transform" ) {
5856 NativeScriptAnimationPlayer . parseTransform ( < string > value , keyframeInfo ) ;
5957 }
6058 }
6159 }
62- keyframeAnimationInfo . keyframes . push ( keyframeInfo )
60+ keyframeAnimationInfo . keyframes . push ( keyframeInfo ) ;
6361 }
6462
6563 this . animation = KeyframeAnimation . keyframeAnimationFromInfo ( keyframeAnimationInfo , observable . ValueSource . VisualState ) ;
@@ -79,7 +77,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
7977 if ( this . animation ) {
8078 this . animation . play ( this . target )
8179 . then ( ( ) => { this . _onFinish ( ) ; } )
82- . catch ( ( e ) => { } ) ;
80+ . catch ( ( e ) => { } ) ;
8381 }
8482 }
8583
@@ -110,11 +108,11 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
110108 setPosition ( p : any ) : void {
111109 throw new Error ( "AnimationPlayer.setPosition method is not supported!" ) ;
112110 }
113-
111+
114112 getPosition ( ) : number {
115113 return 0 ;
116114 }
117-
115+
118116 static animationTimingFunctionConverter ( value ) : any {
119117 switch ( value ) {
120118 case "ease" :
@@ -136,9 +134,9 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
136134 throw new Error ( "Invalid value for animation: " + value ) ;
137135 }
138136 return enums . AnimationCurve . cubicBezier (
139- NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 0 ] ) ,
140- NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 1 ] ) ,
141- NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 2 ] ) ,
137+ NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 0 ] ) ,
138+ NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 1 ] ) ,
139+ NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 2 ] ) ,
142140 NativeScriptAnimationPlayer . bezieArgumentConverter ( bezierArr [ 3 ] ) ) ;
143141 }
144142 else {
@@ -154,7 +152,7 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
154152 return result ;
155153 }
156154
157- static transformConverter ( value : any ) : Object {
155+ static transformConverter ( value : any ) : Object {
158156 if ( value === "none" ) {
159157 let operations = { } ;
160158 operations [ value ] = value ;
@@ -166,20 +164,20 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
166164 let pos = 0 ;
167165 while ( pos < value . length ) {
168166 if ( value [ pos ] === " " || value [ pos ] === "," ) {
169- pos ++ ;
167+ pos ++ ;
170168 }
171169 else if ( value [ pos ] === "(" ) {
172170 let start = pos + 1 ;
173171 while ( pos < value . length && value [ pos ] !== ")" ) {
174- pos ++ ;
172+ pos ++ ;
175173 }
176174 let operand = value . substring ( start , pos ) ;
177175 operations [ operator ] = operand . trim ( ) ;
178176 operator = "" ;
179- pos ++ ;
177+ pos ++ ;
180178 }
181179 else {
182- operator += value [ pos ++ ] ;
180+ operator += value [ pos ++ ] ;
183181 }
184182 }
185183 return operations ;
@@ -196,29 +194,29 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
196194 for ( let transform in newTransform ) {
197195 switch ( transform ) {
198196 case "scaleX" :
199- animationInfo . declarations . push ( { property : "scale" , value : { x : parseFloat ( newTransform [ transform ] ) , y : 1 } } ) ;
197+ animationInfo . declarations . push ( { property : "scale" , value : { x : parseFloat ( newTransform [ transform ] ) , y : 1 } } ) ;
200198 break ;
201199 case "scaleY" :
202- animationInfo . declarations . push ( { property : "scale" , value : { x : 1 , y : parseFloat ( newTransform [ transform ] ) } } ) ;
200+ animationInfo . declarations . push ( { property : "scale" , value : { x : 1 , y : parseFloat ( newTransform [ transform ] ) } } ) ;
203201 break ;
204202 case "scale" :
205203 case "scale3d" :
206204 values = newTransform [ transform ] . split ( "," ) ;
207205 if ( values . length === 2 || values . length === 3 ) {
208- animationInfo . declarations . push ( { property : "scale" , value : { x : parseFloat ( values [ 0 ] ) , y : parseFloat ( values [ 1 ] ) } } ) ;
206+ animationInfo . declarations . push ( { property : "scale" , value : { x : parseFloat ( values [ 0 ] ) , y : parseFloat ( values [ 1 ] ) } } ) ;
209207 }
210208 break ;
211209 case "translateX" :
212- animationInfo . declarations . push ( { property : "translate" , value : { x : parseFloat ( newTransform [ transform ] ) , y : 0 } } ) ;
210+ animationInfo . declarations . push ( { property : "translate" , value : { x : parseFloat ( newTransform [ transform ] ) , y : 0 } } ) ;
213211 break ;
214212 case "translateY" :
215- animationInfo . declarations . push ( { property : "translate" , value : { x : 0 , y : parseFloat ( newTransform [ transform ] ) } } ) ;
213+ animationInfo . declarations . push ( { property : "translate" , value : { x : 0 , y : parseFloat ( newTransform [ transform ] ) } } ) ;
216214 break ;
217215 case "translate" :
218216 case "translate3d" :
219217 values = newTransform [ transform ] . split ( "," ) ;
220218 if ( values . length === 2 || values . length === 3 ) {
221- animationInfo . declarations . push ( { property : "translate" , value : { x : parseFloat ( values [ 0 ] ) , y : parseFloat ( values [ 1 ] ) } } ) ;
219+ animationInfo . declarations . push ( { property : "translate" , value : { x : parseFloat ( values [ 0 ] ) , y : parseFloat ( values [ 1 ] ) } } ) ;
222220 }
223221 break ;
224222 case "rotate" :
@@ -227,11 +225,11 @@ export class NativeScriptAnimationPlayer implements AnimationPlayer {
227225 if ( text . slice ( - 3 ) === "rad" ) {
228226 val = val * ( 180.0 / Math . PI ) ;
229227 }
230- animationInfo . declarations . push ( { property : "rotate" , value : val } ) ;
228+ animationInfo . declarations . push ( { property : "rotate" , value : val } ) ;
231229 case "none" :
232- animationInfo . declarations . push ( { property : "scale" , value : { x : 1 , y : 1 } } ) ;
233- animationInfo . declarations . push ( { property : "translate" , value : { x : 0 , y : 0 } } ) ;
234- animationInfo . declarations . push ( { property : "rotate" , value : 0 } ) ;
230+ animationInfo . declarations . push ( { property : "scale" , value : { x : 1 , y : 1 } } ) ;
231+ animationInfo . declarations . push ( { property : "translate" , value : { x : 0 , y : 0 } } ) ;
232+ animationInfo . declarations . push ( { property : "rotate" , value : 0 } ) ;
235233 break ;
236234 }
237235 }
0 commit comments