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

Commit

Permalink
[BUG] 修正动画处理时逐帧模拟的计算误差及逻辑问题,详见 #2347
Browse files Browse the repository at this point in the history
  • Loading branch information
keqiongpan committed Apr 22, 2019
1 parent 5fec7c5 commit d7620e0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ios/sdk/WeexSDK/Sources/Module/WXTransition.mm
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,15 @@ - (void)_calculatetransitionProcessingStyle
if (_propertyArray.count == 0) {
return;
}
double per = 1000 * (_transitionCount + 1 ) / (60 * _transitionDuration);//linear

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

NSString *transformString = [NSString string];
for (WXTransitionInfo *info in _propertyArray) {
if ([info.propertyName isEqualToString:@"backgroundColor"]) {
Expand Down

0 comments on commit d7620e0

Please sign in to comment.