You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/03 09:51:20 UTC

[2/6] incubator-weex git commit: * [ios] apply transform when stop animation and start animation

* [ios] apply transform when stop animation and start animation


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2ad05e5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2ad05e5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2ad05e5a

Branch: refs/heads/0.16-dev
Commit: 2ad05e5a5c779b56b75c68d55ea6c76bf349daf2
Parents: 2296518
Author: acton393 <zh...@gmail.com>
Authored: Wed Jul 26 11:39:16 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Wed Jul 26 11:39:16 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTransform.m    | 4 ++--
 ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ad05e5a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
index edd3177..0948905 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTransform.m
@@ -174,7 +174,7 @@
     CATransform3D nativeTansform3D = CATransform3DIdentity;
     
     if (_perspective && !isinf(_perspective)) {
-        nativeTansform3D.m34 = -1.0/_perspective;
+        nativeTansform3D.m34 = -1.0/_perspective*[UIScreen mainScreen].scale;
     }
     if (!view || view.bounds.size.width <= 0 || view.bounds.size.height <= 0) {
         return nativeTansform3D;
@@ -232,7 +232,7 @@
     CATransform3D nativeTransform3d = [self nativeTransformWithView:view];
     if (!CATransform3DEqualToTransform(view.layer.transform, nativeTransform3d)){
         CATransform3D presentationTransform = view.layer.presentationLayer.transform;
-        if (presentationTransform.m34 != 0) {
+        if (presentationTransform.m34 != 0 && !isinf(_perspective)) {
             //  just for perspective
             nativeTransform3d = presentationTransform;
         }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ad05e5a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
index 7917d7f..bd2c868 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
@@ -85,6 +85,7 @@
 
 - (void)animationDidStart:(CAAnimation *)anim
 {
+    [self applyTransform];
 }
 
 -(void)applyTransform
@@ -118,7 +119,10 @@
         return;
     }
     
-    [self applyTransform];
+    float perspective = _animationInfo.target->_perspective;
+    if (!isinf(perspective)) {
+        [self applyTransform];
+    }
     
     if ([_animationInfo.propertyName hasPrefix:@"bounds.size"]) {
         /*