PinImageViewCollisionAnimator

class PinImageViewCollisionAnimator

Helper class animates pin image with physics

  • Physics related animation

    Declaration

    Swift

    var snapAnimator: UIDynamicAnimator?
  • Snap behavior

    Declaration

    Swift

    var snapBehavior: UISnapBehavior?
  • Reference view that will serves as the coordinate system

    Declaration

    Swift

    weak var referenceView: UIView?
  • Pin Image view

    Declaration

    Swift

    weak var pinImageView: UIView?
  • Prepares helper class with necessary parameters. Prepare method should be called before using movePin

    Declaration

    Swift

    func prepare(referenceView: UIView, pinImageView: UIView)

    Parameters

    referenceView

    Reference view that will serves as the coordinate system

    pinImageView

    Pin Image View

  • Moves pin with animation and physics, simulating the collision effect

    Declaration

    Swift

    func movePin(force: Double, angle: CGFloat, position: SFWConfiguration.Position)

    Parameters

    force

    The force that will affect to collision effect, should be more than 0

    angle

    The angle which will be rotated the Pin Image View

    position

    PinImageView’s position

  • Moves pin with animation and physics, simulating the collision effect

    Declaration

    Swift

    func movePinIfNeeded(collisionEffect: CollisionEffect?, position: SFWConfiguration.Position?)

    Parameters

    collisionEffect

    Collision effect object

    position

    PinImageView’s position