예제 #1
0
        public static void RotateToAngle(this UIView view, float angle, double duration, UIViewAnimationRotationDirection direction, int repeatCount, bool shouldAutoReverse)
        {
            CABasicAnimation rotateAnimation = CABasicAnimation.FromKeyPath("transform.rotation.z");

            rotateAnimation.To             = direction == UIViewAnimationRotationDirection.Right ? NSNumber.FromFloat(angle) : NSNumber.FromFloat(-angle);
            rotateAnimation.Duration       = duration;
            rotateAnimation.AutoReverses   = shouldAutoReverse;
            rotateAnimation.RepeatCount    = repeatCount;
            rotateAnimation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);

            view.Layer.AddAnimation(rotateAnimation, "transform.rotation.z");
        }
예제 #2
0
        public static void RotateToAngle(this UIView view, float angle, double duration, UIViewAnimationRotationDirection direction, int repeatCount, bool shouldAutoReverse)
        {
            CABasicAnimation rotateAnimation = CABasicAnimation.FromKeyPath("transform.rotation.z");

            rotateAnimation.To = direction == UIViewAnimationRotationDirection.Right ? NSNumber.FromFloat(angle) : NSNumber.FromFloat(-angle);
            rotateAnimation.Duration = duration;
            rotateAnimation.AutoReverses = shouldAutoReverse;
            rotateAnimation.RepeatCount = repeatCount;
            rotateAnimation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.EaseInEaseOut);

            view.Layer.AddAnimation(rotateAnimation, "transform.rotation.z");
        }