Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit d2ba8d0

Browse files
committed
[BUG] 修正动画处理时,对于transition-duration小于1000 / 60微秒的情况,没有动画效果也没有更新最终样式的问题。
1 parent d7620e0 commit d2ba8d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ios/sdk/WeexSDK/Sources/Module/WXTransition.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ - (void)_calculatetransitionProcessingStyle
319319
}
320320

321321
// Bugfix: https://github.com/apache/incubator-weex/issues/2347
322-
NSUInteger frameCount = _transitionDuration * 60 / 1000;
322+
NSUInteger frameCount = MAX(_transitionDuration * 60 / 1000, 1);
323323
NSUInteger currentFrame = _transitionCount + 1;
324324
double per = (double)currentFrame / frameCount; //linear
325-
if (![[NSString stringWithFormat:@"%@",_transitionTimingFunction] isEqualToString: kCAMediaTimingFunctionLinear]) {
325+
if (currentFrame < frameCount && ![[NSString stringWithFormat:@"%@",_transitionTimingFunction] isEqualToString: kCAMediaTimingFunctionLinear]) {
326326
per = [self solveWithx:per epsilon:SOLVE_EPS(_transitionDuration)];
327327
}
328328

@@ -449,7 +449,7 @@ - (void)_awakeTransitionDisplayLink
449449
- (void)_handleTransitionDisplayLink
450450
{
451451
WXAssertComponentThread();
452-
int count = _transitionDuration * 60 / 1000;
452+
int count = MAX(_transitionDuration * 60 / 1000, 1);
453453
if (_transitionCount >= count) {
454454
[self _suspendTransitionDisplayLink];
455455
[self _resetProcessAnimationParameter];

0 commit comments

Comments
 (0)