@@ -136,7 +136,8 @@ export class Animation extends common.Animation implements definition.Animation
136
136
var animators = new Array < android . animation . Animator > ( ) ;
137
137
var propertyUpdateCallbacks = new Array < Function > ( ) ;
138
138
var propertyResetCallbacks = new Array < Function > ( ) ;
139
- var originalValue ;
139
+ var originalValue1 ;
140
+ var originalValue2 ;
140
141
var density = utils . layout . getDisplayDensity ( ) ;
141
142
var xyObjectAnimators : any ;
142
143
var animatorSet : android . animation . AnimatorSet ;
@@ -157,16 +158,16 @@ export class Animation extends common.Animation implements definition.Animation
157
158
switch ( propertyAnimation . property ) {
158
159
159
160
case common . Properties . opacity :
160
- originalValue = nativeView . getAlpha ( ) ;
161
+ originalValue1 = nativeView . getAlpha ( ) ;
161
162
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
162
163
nativeArray [ 0 ] = propertyAnimation . value ;
163
164
propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . opacity = propertyAnimation . value } ) ) ;
164
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setAlpha ( originalValue ) ; } ) ) ;
165
+ propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setAlpha ( originalValue1 ) ; } ) ) ;
165
166
animators . push ( android . animation . ObjectAnimator . ofFloat ( nativeView , "alpha" , nativeArray ) ) ;
166
167
break ;
167
168
168
169
case common . Properties . backgroundColor :
169
- originalValue = nativeView . getBackground ( ) ;
170
+ originalValue1 = nativeView . getBackground ( ) ;
170
171
nativeArray = java . lang . reflect . Array . newInstance ( java . lang . Object . class , 2 ) ;
171
172
nativeArray [ 0 ] = propertyAnimation . target . backgroundColor ? java . lang . Integer . valueOf ( ( < color . Color > propertyAnimation . target . backgroundColor ) . argb ) : java . lang . Integer . valueOf ( - 1 ) ;
172
173
nativeArray [ 1 ] = java . lang . Integer . valueOf ( ( < color . Color > propertyAnimation . value ) . argb ) ;
@@ -179,28 +180,35 @@ export class Animation extends common.Animation implements definition.Animation
179
180
} ) ) ;
180
181
181
182
propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . backgroundColor = propertyAnimation . value ; } ) ) ;
182
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setBackground ( originalValue ) ; } ) ) ;
183
+ propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setBackground ( originalValue1 ) ; } ) ) ;
183
184
animators . push ( animator ) ;
184
185
break ;
185
186
186
187
case common . Properties . translate :
187
188
xyObjectAnimators = java . lang . reflect . Array . newInstance ( android . animation . Animator . class , 2 ) ;
188
189
189
- originalValue = nativeView . getTranslationX ( ) ;
190
190
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
191
191
nativeArray [ 0 ] = propertyAnimation . value . x * density ;
192
192
xyObjectAnimators [ 0 ] = android . animation . ObjectAnimator . ofFloat ( nativeView , "translationX" , nativeArray ) ;
193
193
xyObjectAnimators [ 0 ] . setRepeatCount ( Animation . _getAndroidRepeatCount ( propertyAnimation . iterations ) ) ;
194
- propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . translateX = propertyAnimation . value . x ; } ) ) ;
195
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setTranslationX ( originalValue ) ; } ) ) ;
196
194
197
- originalValue = nativeView . getTranslationY ( ) ;
198
195
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
199
196
nativeArray [ 0 ] = propertyAnimation . value . y * density ;
200
197
xyObjectAnimators [ 1 ] = android . animation . ObjectAnimator . ofFloat ( nativeView , "translationY" , nativeArray ) ;
201
198
xyObjectAnimators [ 1 ] . setRepeatCount ( Animation . _getAndroidRepeatCount ( propertyAnimation . iterations ) ) ;
202
- propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . translateY = propertyAnimation . value . y ; } ) ) ;
203
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setTranslationY ( originalValue ) ; } ) ) ;
199
+
200
+ originalValue1 = nativeView . getTranslationX ( ) ;
201
+ originalValue2 = nativeView . getTranslationY ( ) ;
202
+
203
+ propertyUpdateCallbacks . push ( checkAnimation ( ( ) => {
204
+ propertyAnimation . target . translateX = propertyAnimation . value . x ;
205
+ propertyAnimation . target . translateY = propertyAnimation . value . y ;
206
+ } ) ) ;
207
+
208
+ propertyResetCallbacks . push ( checkAnimation ( ( ) => {
209
+ nativeView . setTranslationX ( originalValue1 ) ;
210
+ nativeView . setTranslationY ( originalValue2 ) ;
211
+ } ) ) ;
204
212
205
213
animatorSet = new android . animation . AnimatorSet ( ) ;
206
214
animatorSet . playTogether ( xyObjectAnimators ) ;
@@ -211,21 +219,28 @@ export class Animation extends common.Animation implements definition.Animation
211
219
case common . Properties . scale :
212
220
xyObjectAnimators = java . lang . reflect . Array . newInstance ( android . animation . Animator . class , 2 ) ;
213
221
214
- originalValue = nativeView . getScaleX ( ) ;
215
222
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
216
223
nativeArray [ 0 ] = propertyAnimation . value . x ;
217
224
xyObjectAnimators [ 0 ] = android . animation . ObjectAnimator . ofFloat ( nativeView , "scaleX" , nativeArray ) ;
218
225
xyObjectAnimators [ 0 ] . setRepeatCount ( Animation . _getAndroidRepeatCount ( propertyAnimation . iterations ) ) ;
219
- propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . scaleX = propertyAnimation . value . x ; } ) ) ;
220
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setScaleX ( originalValue ) ; } ) ) ;
221
226
222
- originalValue = nativeView . getScaleY ( ) ;
223
227
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
224
228
nativeArray [ 0 ] = propertyAnimation . value . y ;
225
229
xyObjectAnimators [ 1 ] = android . animation . ObjectAnimator . ofFloat ( nativeView , "scaleY" , nativeArray ) ;
226
230
xyObjectAnimators [ 1 ] . setRepeatCount ( Animation . _getAndroidRepeatCount ( propertyAnimation . iterations ) ) ;
227
- propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . scaleY = propertyAnimation . value . y ; } ) ) ;
228
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setScaleY ( originalValue ) ; } ) ) ;
231
+
232
+ originalValue1 = nativeView . getScaleX ( ) ;
233
+ originalValue2 = nativeView . getScaleY ( ) ;
234
+
235
+ propertyUpdateCallbacks . push ( checkAnimation ( ( ) => {
236
+ propertyAnimation . target . scaleX = propertyAnimation . value . x ;
237
+ propertyAnimation . target . scaleY = propertyAnimation . value . y ;
238
+ } ) ) ;
239
+
240
+ propertyResetCallbacks . push ( checkAnimation ( ( ) => {
241
+ nativeView . setScaleY ( originalValue1 ) ;
242
+ nativeView . setScaleY ( originalValue2 ) ;
243
+ } ) ) ;
229
244
230
245
animatorSet = new android . animation . AnimatorSet ( ) ;
231
246
animatorSet . playTogether ( xyObjectAnimators ) ;
@@ -234,11 +249,11 @@ export class Animation extends common.Animation implements definition.Animation
234
249
break ;
235
250
236
251
case common . Properties . rotate :
237
- originalValue = nativeView . getRotation ( ) ;
252
+ originalValue1 = nativeView . getRotation ( ) ;
238
253
nativeArray = java . lang . reflect . Array . newInstance ( floatType , 1 ) ;
239
254
nativeArray [ 0 ] = propertyAnimation . value ;
240
255
propertyUpdateCallbacks . push ( checkAnimation ( ( ) => { propertyAnimation . target . rotate = propertyAnimation . value ; } ) ) ;
241
- propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setRotation ( originalValue ) ; } ) ) ;
256
+ propertyResetCallbacks . push ( checkAnimation ( ( ) => { nativeView . setRotation ( originalValue1 ) ; } ) ) ;
242
257
animators . push ( android . animation . ObjectAnimator . ofFloat ( nativeView , "rotation" , nativeArray ) ) ;
243
258
break ;
244
259
0 commit comments