SpinningWheelAnimator
class SpinningWheelAnimator : NSObject
extension SpinningWheelAnimator: CAAnimationDelegate
extension SpinningWheelAnimator: CollisionDetectable
Spinning wheel animator
-
Animation object
Declaration
Swift
weak var animationObject: SpinningAnimatorProtocol?
-
Edge Collision Detector
Declaration
Swift
lazy var edgeCollisionDetector: CollisionDetector { get set }
-
Center Collision Detector
Declaration
Swift
lazy var centerCollisionDetector: CollisionDetector { get set }
-
Animation Completion Block
Declaration
Swift
var completionBlock: ((Bool) -> Void)?
-
Current rotation position used to know where is last time rotation stopped
Declaration
Swift
var currentRotationPosition: CGFloat?
-
Rotation direction offset
Declaration
Swift
var rotationDirectionOffset: CGFloat { get }
-
Is object layer is currently rotation
Declaration
Swift
var isRotating: Bool { get }
-
Initialize spinning wheel animator
Declaration
Swift
init(withObjectToAnimate animationObject: SpinningAnimatorProtocol)
Parameters
animationObject
Animation object
-
Start indefinite rotation animation
Declaration
Swift
func addIndefiniteRotationAnimation(speed: CGFloat = 1, onEdgeCollision: ((_ progress: Double?) -> Void)? = nil, onCenterCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
speed
Rotation speed, speed is equal to full rotation quantity in one second
-
addRotationAnimation(fullRotationsCount:
animationDuration: rotationOffset: completionBlock: onEdgeCollision: onCenterCollision: ) Start rotation animation
Declaration
Swift
func addRotationAnimation(fullRotationsCount: Int, animationDuration: CFTimeInterval, rotationOffset: CGFloat = 0.0, completionBlock: ((_ finished: Bool) -> Void)? = nil, onEdgeCollision: ((_ progress: Double?) -> Void)? = nil, onCenterCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
fullRotationsCount
Full rotations until start deceleration
animationDuration
Animation duration
rotationOffset
Rotation offset
completionBlock
Completion block
-
Stops animations and collisions detectors if needed
Declaration
Swift
func stop()
-
Undocumented
Declaration
Swift
func resetRotationPosition()
-
Undocumented
Declaration
Swift
func animationDidStop(_ anim: CAAnimation, finished flag: Bool)