ContinuousCollisionCalculator

class ContinuousCollisionCalculator

Calculates a collision during continuous animation

  • The time when the last collision accrued

    Declaration

    Swift

    var lastCollisionTime: CFTimeInterval
  • Rotation degree offset

    Declaration

    Swift

    var rotationDegreeOffset: CGFloat
  • Calculates collision interval

    Declaration

    Swift

    func calculateCollisionInterval(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

  • Calculates collisions

    Declaration

    Swift

    func calculateCollisionsIfNeeded(timestamp: CFTimeInterval, onCollision: ((_ progress: Double?) -> Void)? = nil)

    Parameters

    timestamp

    Time from the animation begun

    onCollision

    On collision callback

  • Resets parameters

    Declaration

    Swift

    func reset()