wangrui460/WRNavigationBar

转场动画与wrPopProgress计算问题

yexiannan opened this issue · 1 comments

问题:透明度为1页面pop到透明度为0页面时,转场动画未按照设置执行0.12s而是0.5s,且wrPopProgress计算有问题,导致0.12s到0.5s转场动画结束前,导航栏背景色并未完全变为预期的效果
截屏2021-12-31 下午4 08 57
截屏2021-12-31 下午4 12 32

暂时将计算进度时小数点第一位后向上取整解决

static CGFloat wrPopDuration = 0.12;
static int wrPopDisplayCount = 0;
- (CGFloat)wrPopProgress {
    CGFloat all = 60 * wrPopDuration;
    int current = MIN(all, wrPopDisplayCount);
    CGFloat progress = current / all;
    return ceilf(progress * 10) / 10.f;
}

static CGFloat wrPushDuration = 0.10;
static int wrPushDisplayCount = 0;
- (CGFloat)wrPushProgress {
    CGFloat all = 60 * wrPushDuration;
    int current = MIN(all, wrPushDisplayCount);
    CGFloat progress = current / all;
    return ceilf(progress * 10) / 10.f;
}

转场动画持续时间修改无效可能跟苹果动画效果改为usingSpringWithDamping有关