快速的部分pagecurl动画 [英] Partial pagecurl animation with swift

查看:133
本文介绍了快速的部分pagecurl动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm looking for a way to indicate a pagecurl animation on an uiview to give the user a hint that he can scroll through some pages. It should be some kind of partial pagecurl.

问题是我不知道该怎么做.我找到了一些教程,但仅针对目标c,我不知道如何将其转换为swift:

The problem is that I don't know how to do that. I found some tutorials but only for objective c and I don't know how transfer it into 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

推荐答案

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)
})

这篇关于快速的部分pagecurl动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆