CollisionDetectable
protocol CollisionDetectable : NSObject
Collision Detection Support protocol
-
Animation object
Declaration
Swift
var animationObject: SpinningAnimatorProtocol? { get set }
-
Edge Collision Detector
Declaration
Swift
var edgeCollisionDetector: CollisionDetector { get set }
-
Center Collision Detector
Declaration
Swift
var centerCollisionDetector: CollisionDetector { get set }
-
startCollisionDetectorsIfNeeded()
Extension methodStarts all collision detectors if needed
Declaration
Swift
func startCollisionDetectorsIfNeeded()
-
stopCollisionDetectorsIfNeeded()
Extension methodStops all collision detectos if needed
Declaration
Swift
func stopCollisionDetectorsIfNeeded()
-
prepareAllCollisionDetectorsIfNeeded(with:
Extension methodanimationDuration: onEdgeCollision: onCenterCollision: ) Prepares all collision detectors if needed
Declaration
Swift
func prepareAllCollisionDetectorsIfNeeded(with rotationDegree: CGFloat, animationDuration: CFTimeInterval, onEdgeCollision: ((_ progress: Double?) -> Void)? = nil, onCenterCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
rotationDegree
Animation full rotation degree
animationDuration
Animation duration time
onEdgeCollision
On edge collision callback
onCenterCollision
On center collision callback
-
Prepare collision detector if needed by collision type
Declaration
Swift
func prepareCollisionDetectorIfNeeded(for type: CollisionType, with rotationDegree: CGFloat, animationDuration: CFTimeInterval, onCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
type
Collision type
rotationDegree
Animation full rotation degree
animationDuration
Animation duration time
onCollision
On collision callback
-
prepareAllCollisionDetectorsIfNeeded(with:
Extension methodspeed: speedAcceleration: onEdgeCollision: onCenterCollision: ) Prepare all collision detectors if needed with continuous animation
Declaration
Swift
func prepareAllCollisionDetectorsIfNeeded(with rotationDegree: CGFloat, speed: CGFloat, speedAcceleration: CGFloat, onEdgeCollision: ((_ progress: Double?) -> Void)? = nil, onCenterCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
rotationDegree
Animation full rotation degree
speed
Rotation speed
speedAcceleration
Rotation speed acceleration
onEdgeCollision
On edge collision callback
onCenterCollision
On center collision callback
-
Prepare collision detector if needed with continuous animation by collision type
Declaration
Swift
func prepareCollisionDetectorIfNeeded(for type: CollisionType, with rotationDegree: CGFloat, speed: CGFloat, speedAcceleration: CGFloat, onCollision: ((_ progress: Double?) -> Void)? = nil)
Parameters
type
Collision type
rotationDegree
Animation full rotation degree
speed
Rotation speed
speedAcceleration
Rotation speed acceleration
onCollision
On collision callback
-
rotationDegreeOffset(for:
Extension method) Returns rotation degree offset to collision type
Declaration
Swift
func rotationDegreeOffset(for type: CollisionType) -> CGFloat
Parameters
type
Collision type
Return Value
Rotation degree offset
-
startCollisionDetectorIfNeeded(type:
Extension method) Starts collision detector if needed by collision type
Declaration
Swift
func startCollisionDetectorIfNeeded(type: CollisionType)
Parameters
type
Collision type
-
stopCollisionDetectorIfNeeded(type:
Extension method) Stops collision detector if needed by collision type
Declaration
Swift
func stopCollisionDetectorIfNeeded(type: CollisionType)
Parameters
type
Collision type
-
isCollisionDetectorOn(for:
Extension method) Checks are collision detector is on for collision type
Declaration
Swift
func isCollisionDetectorOn(for type: CollisionType) -> Bool
Parameters
type
Collision type
Return Value
Is collision detection on or off