+ [ios] update animation logic
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/68d647b6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/68d647b6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/68d647b6 Branch: refs/heads/0.15-dev Commit: 68d647b6bd8679bf930a76b5dd528125a6a86465 Parents: 08313fe Author: é½å±± <sunjjb...@163.com> Authored: Thu Jul 6 11:58:07 2017 +0800 Committer: é½å±± <sunjjb...@163.com> Committed: Thu Jul 6 11:58:07 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/68d647b6/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 fc12769..3f81c37 100644 --- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m +++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m @@ -89,6 +89,11 @@ return; } + [self applyTransform]; +} + +-(void)applyTransform +{ if ([_animationInfo.propertyName hasPrefix:@"transform"]) { WXTransform *transform = _animationInfo.target->_transform; [transform applyTransformForView:_animationInfo.target.view]; @@ -355,9 +360,13 @@ WX_EXPORT_METHOD(@selector(transition:args:callback:)) layer.anchorPoint = CGPointZero; layer.frame = originFrame; } - [layer addAnimation:animation forKey:info.propertyName]; + if(WXFloatEqual(animation.duration, 0) || WXFloatLessThan(animation.duration, 0)){ - [layer removeAllAnimations]; + if([delegate respondsToSelector:@selector(applyTransform)]) { + [delegate applyTransform]; + } + } else { + [layer addAnimation:animation forKey:info.propertyName]; } }