Umair Afzal
Umair Afzal

Reputation: 5039

Animation starts slowly and get faster with time ios Swift

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) 

Upvotes: 1

Views: 2421

Answers (1)

rob mayoff
rob mayoff

Reputation: 385500

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)

Upvotes: 2

Related Questions