动画慢慢启动,并获得更快的随时间的iOS斯威夫特 [英] Animation starts slowly and get faster with time ios Swift

查看:530
本文介绍了动画慢慢启动,并获得更快的随时间的iOS斯威夫特的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图动画的ImageView的旋转。它旋转和动画,但我的动画启动缓慢,并随着时间的推移加快
可以说,我正与5秒的持续时间进行动画那么前1-2秒我的形象正在慢慢旋转,但随着时间越接近5它加速了这里是我的code

  UIView.animateWithDuration(5.0,延迟:0,选项:.Repeat,动画:{
//风扇的UIImageView
        self.fan.transform = CGAffineTransformMakeRotation((180.0 * CGFloat的(M_PI))/ 180.0)
    }完成:无)


解决方案

默认的动画曲线 .CurveEaseInOut 。你想 .CurveLinear

  UIView.animateWithDuration(5.0,延迟:0,选项:[.Repeat,.CurveLinear]动画:{
//风扇的UIImageView
        self.fan.transform = CGAffineTransformMakeRotation((180.0 * CGFloat的(M_PI))/ 180.0)
    }完成:无)

i am trying to animate the rotation of an imageview. it is rotating and animating but my animation start slowly and it speed up with time lets say i am performing animation with 5 seconds duration then first 1-2 seconds my image is rotating slowly but as time gets closer to 5 it speeds up here is my code

UIView.animateWithDuration(5.0, delay:0 , options: .Repeat , animations: {
//fan is UIImageView
        self.fan.transform = CGAffineTransformMakeRotation((180.0 * CGFloat(M_PI)) / 180.0)
    }, completion: nil) 

解决方案

The default animation curve is .CurveEaseInOut. You want .CurveLinear.

UIView.animateWithDuration(5.0, delay:0, options: [.Repeat, .CurveLinear] , animations: {
//fan is UIImageView
        self.fan.transform = CGAffineTransformMakeRotation((180.0 * CGFloat(M_PI)) / 180.0)
    }, completion: nil)

这篇关于动画慢慢启动,并获得更快的随时间的iOS斯威夫特的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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