feat:when cancel Animation,sync the properties from native

This commit is contained in:
pengfei.zhou
2021-04-22 14:54:25 +08:00
committed by osborn
parent 819feb1617
commit cdd25caa7d
12 changed files with 377 additions and 324 deletions

View File

@@ -579,7 +579,14 @@ - (void)cancelAnimation:(NSString *)animationId withPromise:(DoricPromise *)prom
((AnimationCallback *) caAnimation.delegate).cancelBlock();
}
[self.view.layer removeAnimationForKey:animationId];
[promise resolve:nil];
CGAffineTransform affineTransform = self.view.layer.presentationLayer.affineTransform;
self.translationX = @(affineTransform.tx);
self.translationY = @(affineTransform.ty);
CGFloat angle = atan2f((float) affineTransform.b, (float) affineTransform.a);
self.rotation = @(angle / M_PI);
self.scaleX = @(affineTransform.a);
self.scaleY = @(affineTransform.d);
[promise resolve:self.transformation];
}
- (CFTimeInterval)computeDurationOfAnimations:(NSArray<CAAnimation *> *)animations {