Force clockwise/anticlockwise rotation for a CABasicAnimation of a UIImageView

前端 未结 4 1189
清酒与你
清酒与你 2021-02-15 12:46

I\'m animating a pendulum which swings from 0 degrees to max 200 degrees and then back again. The problem is that if the pendulum goes over 180 degrees, it returns to 0 by the s

4条回答
  •  我寻月下人不归
    2021-02-15 13:30

    I think you have to use this code:

    [rotationAnimation.byValue = [NSNumber numberWithFloat:degreesToRadians(kMax/2))];
    [rotationAnimation.toValue = [NSNumber numberWithFloat:degreesToRadians(kMin)];
    

提交回复
热议问题