首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用UIViewPropertyAnimator旋转360度

如何使用UIViewPropertyAnimator旋转360度
EN

Stack Overflow用户
提问于 2016-12-16 18:41:37
回答 0查看 1.2K关注 0票数 3

如果我想通过UIViewPropertyAnimator利用用户交互动画的优势,我如何按顺时针方向制作360度的对象动画?

代码语言:javascript
复制
// Does not animate
let animator = UIViewPropertyAnimator(duration: 2, curve: .linear) {
    let radians = Angle(360).radians // 6.28318530717959
    view.transform = view.transform.rotated(by: CGFloat(radians))
}
// (Using RxSwift to handle the user interaction via UISlider, 
// but that can be ignored as an implementation detail for this question.)
let scrubs = slider.rx.value.asDriver()
scrubs.drive(onNext: { (value:Float) -> Void in
    animator.fractionComplete = CGFloat(value)
})
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41182567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档