Skip to content

Commit 15a9c23

Browse files
CatchABusNathanWalker
authored andcommitted
fix(ios): Proper iOS rotate animation
1 parent a531232 commit 15a9c23

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

packages/core/ui/animation/index.ios.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,12 @@ export class Animation extends AnimationBase {
517517
}
518518

519519
private static _createGroupAnimation(args: AnimationInfo, animation: PropertyAnimation) {
520+
const animations = NSMutableArray.alloc<CAAnimation>().initWithCapacity(3);
520521
const groupAnimation = CAAnimationGroup.new();
521522
groupAnimation.duration = args.duration;
522-
if (args.repeatCount !== undefined) {
523-
groupAnimation.repeatCount = args.repeatCount;
524-
}
525-
if (args.delay !== undefined) {
526-
groupAnimation.beginTime = CACurrentMediaTime() + args.delay;
527-
}
528-
if (animation.curve !== undefined) {
529-
groupAnimation.timingFunction = animation.curve;
530-
}
531-
const animations = NSMutableArray.alloc<CAAnimation>().initWithCapacity(3);
532523

533524
args.subPropertiesToAnimate.forEach((property) => {
534-
const basicAnimationArgs = { ...args, duration: undefined, repeatCount: undefined, delay: undefined, curve: undefined };
525+
const basicAnimationArgs = { ...args };
535526
basicAnimationArgs.propertyNameToAnimate = `${args.propertyNameToAnimate}.${property}`;
536527
basicAnimationArgs.fromValue = args.fromValue[property];
537528
basicAnimationArgs.toValue = args.toValue[property];
@@ -676,11 +667,18 @@ export class Animation extends AnimationBase {
676667
result = CATransform3DScale(result, x === 0 ? 0.001 : x, y === 0 ? 0.001 : y, 1);
677668
}
678669

670+
if (value[Properties.rotate] !== undefined) {
671+
const x = value[Properties.rotate].x;
672+
const y = value[Properties.rotate].y;
673+
const z = value[Properties.rotate].z;
674+
result = iosHelper.applyRotateTransform(result, x, y, z);
675+
}
676+
679677
return result;
680678
}
681679

682680
private static _isAffineTransform(property: string): boolean {
683-
return property === _transform || property === Properties.translate || property === Properties.scale;
681+
return property === _transform || property === Properties.translate || property === Properties.scale || property === Properties.rotate;
684682
}
685683

686684
private static _canBeMerged(animation1: PropertyAnimation, animation2: PropertyAnimation) {

0 commit comments

Comments
 (0)