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

Commit

Permalink
[BUG] 修正动画处理时,对于transition-duration小于1000 / 60微秒的情况,没有动画效果也没有更新最终样式的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
keqiongpan committed Apr 23, 2019
1 parent d7620e0 commit d2ba8d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ - (void)_calculatetransitionProcessingStyle
}

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

Expand Down Expand Up @@ -449,7 +449,7 @@ - (void)_awakeTransitionDisplayLink
- (void)_handleTransitionDisplayLink
{
WXAssertComponentThread();
int count = _transitionDuration * 60 / 1000;
int count = MAX(_transitionDuration * 60 / 1000, 1);
if (_transitionCount >= count) {
[self _suspendTransitionDisplayLink];
[self _resetProcessAnimationParameter];
Expand Down

0 comments on commit d2ba8d0

Please sign in to comment.