@@ -309,7 +309,6 @@ export class Animation extends AnimationBase {
309
309
const parent = view . parent as View ;
310
310
311
311
let propertyNameToAnimate = animation . property ;
312
- let subPropertyNameToAnimate ;
313
312
let toValue = animation . value ;
314
313
let fromValue ;
315
314
if ( nativeView ) {
@@ -347,30 +346,9 @@ export class Animation extends AnimationBase {
347
346
style [ setLocal ? rotateYProperty . name : rotateYProperty . keyframe ] = value . y ;
348
347
} ;
349
348
350
- propertyNameToAnimate = 'transform.rotation' ;
351
- subPropertyNameToAnimate = [ 'x' , 'y' , 'z' ] ;
352
- fromValue = {
353
- x : nativeView . layer . valueForKeyPath ( 'transform.rotation.x' ) ,
354
- y : nativeView . layer . valueForKeyPath ( 'transform.rotation.y' ) ,
355
- z : nativeView . layer . valueForKeyPath ( 'transform.rotation.z' ) ,
356
- } ;
357
-
358
- if ( animation . target . rotateX !== undefined && animation . target . rotateX !== 0 && Math . floor ( toValue / 360 ) - toValue / 360 === 0 ) {
359
- fromValue . x = ( animation . target . rotateX * Math . PI ) / 180 ;
360
- }
361
- if ( animation . target . rotateY !== undefined && animation . target . rotateY !== 0 && Math . floor ( toValue / 360 ) - toValue / 360 === 0 ) {
362
- fromValue . y = ( animation . target . rotateY * Math . PI ) / 180 ;
363
- }
364
- if ( animation . target . rotate !== undefined && animation . target . rotate !== 0 && Math . floor ( toValue / 360 ) - toValue / 360 === 0 ) {
365
- fromValue . z = ( animation . target . rotate * Math . PI ) / 180 ;
366
- }
367
-
368
- // Respect only value.z for back-compat until 3D rotations are implemented
369
- toValue = {
370
- x : ( toValue . x * Math . PI ) / 180 ,
371
- y : ( toValue . y * Math . PI ) / 180 ,
372
- z : ( toValue . z * Math . PI ) / 180 ,
373
- } ;
349
+ propertyNameToAnimate = 'transform' ;
350
+ fromValue = NSValue . valueWithCATransform3D ( nativeView . layer . transform ) ;
351
+ toValue = NSValue . valueWithCATransform3D ( iosHelper . applyRotateTransform ( nativeView . layer . transform , toValue . x , toValue . y , toValue . z ) ) ;
374
352
break ;
375
353
case Properties . translate :
376
354
animation . _originalValue = {
@@ -473,7 +451,6 @@ export class Animation extends AnimationBase {
473
451
return {
474
452
propertyNameToAnimate : propertyNameToAnimate ,
475
453
fromValue : fromValue ,
476
- subPropertiesToAnimate : subPropertyNameToAnimate ,
477
454
toValue : toValue ,
478
455
duration : duration ,
479
456
repeatCount : repeatCount ,
@@ -517,7 +494,7 @@ export class Animation extends AnimationBase {
517
494
}
518
495
519
496
private static _createGroupAnimation ( args : AnimationInfo , animation : PropertyAnimation ) {
520
- const animations = NSMutableArray . alloc < CAAnimation > ( ) . initWithCapacity ( 3 ) ;
497
+ const animations = NSMutableArray . alloc < CAAnimation > ( ) . initWithCapacity ( args . subPropertiesToAnimate . length ) ;
521
498
const groupAnimation = CAAnimationGroup . new ( ) ;
522
499
groupAnimation . duration = args . duration ;
523
500
@@ -946,9 +923,10 @@ function calculateTransform(view: View): CATransform3D {
946
923
let expectedTransform = new CATransform3D ( CATransform3DIdentity ) ;
947
924
948
925
// Only set perspective if there is 3D rotation
949
- if ( view . rotateX || view . rotateY ) {
950
- expectedTransform . m34 = - 1 / perspective ;
951
- }
926
+ // TODO: Add perspective property to transform animations (not just rotation)
927
+ // if (view.rotateX || view.rotateY) {
928
+ // expectedTransform.m34 = -1 / perspective;
929
+ // }
952
930
953
931
expectedTransform = CATransform3DTranslate ( expectedTransform , view . translateX , view . translateY , 0 ) ;
954
932
expectedTransform = iosHelper . applyRotateTransform ( expectedTransform , view . rotateX , view . rotateY , view . rotate ) ;
0 commit comments