CollisionDetector

class CollisionDetector

Detects collisions

  • Layer that animates

    Declaration

    Swift

    weak var animationObjectLayer: CALayer?
  • On collision callback

    Declaration

    Swift

    var onCollision: ((_ progress: Double?) -> Void)?
  • Initializes collisions detector

    Declaration

    Swift

    init(animationObjectLayer: CALayer?, onCollision: ((_ progress: Double?) -> Void)? = nil)

    Parameters

    animationObjectLayer

    Layer that animates

    onCollision

    On collision callback

  • Prepare collision detection with continuous animation

    Declaration

    Swift

    func prepareWithContinuousAnimation(sliceDegree: CGFloat, rotationDegreeOffset: CGFloat, fullRotationDegree: CGFloat, speed: CGFloat, speedAcceleration: CGFloat)

    Parameters

    sliceDegree

    Slice degree

    rotationDegreeOffset

    Rotation degree offset

    fullRotationDegree

    Animation full rotation degree

    speed

    Animation speed

    speedAcceleration

    Animation speed acceleration

  • Prepare collision detection

    Declaration

    Swift

    func prepare(sliceDegree: CGFloat, rotationDegree: CGFloat, rotationDegreeOffset: CGFloat, animationDuration: CFTimeInterval)

    Parameters

    sliceDegree

    Slice degree

    rotationDegree

    Animation full rotation degree

    rotationDegreeOffset

    Rotation degree offset

    animationDuration

    Animation duration time

  • Starts

    Declaration

    Swift

    func start()
  • Stops

    Declaration

    Swift

    func stop()