使用 swift 进行部分卷页动画

2024-01-16

我正在寻找一种方法来指示 uiview 上的 pagecurl 动画,以向用户提示他可以滚动某些页面。它应该是某种部分卷页。

问题是我不知道该怎么做。我找到了一些教程,但仅适用于 Objective C,我不知道如何将其转移到 swift 中:

 [UIView animateWithDuration:1.0
                     animations:^{
                         CATransition  * animation = [CATransition animation];
                         [animation setDuration:1.2f];
                         animation.startProgress = 0.0;
                         animation.endProgress   = 0.6;
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         [animation setType:@"pageCurl"];
                         [animation setSubtype:@"fromRight"];
                         [animation setRemovedOnCompletion:NO];
                         [animation setFillMode: @"extended"];
                         [animation setRemovedOnCompletion: NO];
                         [[self.animatedUIView layer] addAnimation:animation
                                                      forKey:@"pageFlipAnimation"];
                          [self.animatedUIView addSubview:tempUIView];

                     }
     ];

http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html


UIView.animate(withDuration: 1.0, animations: {
    let animation = CATransition()
    animation.duration = 1.2
    animation.startProgress = 0.0
    animation.endProgress = 0.6
    animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
    animation.type = "pageCurl"
    animation.subtype = "fromRight"
    animation.isRemovedOnCompletion = false
    animation.fillMode = "extended"
    self.animatedUIView.layer.add(animation, forKey: "pageFlipAnimation")
    self.animatedUIView.addSubview(tempUIView)
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 swift 进行部分卷页动画 的相关文章

随机推荐