JJButtonAnimationConfiguration

@objc
public class JJButtonAnimationConfiguration : NSObject

Button animation configuration

  • Initializes and returns a newly allocated button animation configuration object with the specified style.

    Declaration

    Swift

    @objc
    public init(withStyle style: JJButtonAnimationStyle)

    Parameters

    style

    The animation style.

    Return Value

    An initialized button animation configuration object.

  • Button animation style

    See more

    Declaration

    Swift

    @objc
    public enum JJButtonAnimationStyle : Int
  • Button animation style Possible values:

    • .rotation
    • .transition

    Declaration

    Swift

    @objc
    public let style: JJButtonAnimationStyle
  • The angle in radian the button will rotate to when opening.

    Remark

    Is ignored for style .rotation

    Declaration

    Swift

    @objc
    public var angle: CGFloat
  • The image button will transition to when opening.

    Remark

    Is ignored for style .transition

    Declaration

    Swift

    @objc
    public var image: UIImage?
  • Animation settings for opening animation. Default values are:

    • duration = 0.3
    • dampingRatio = 0.55
    • initialVelocity = 0.3

    Declaration

    Swift

    @objc
    public lazy var opening: JJAnimationSettings { get set }
  • Animation settings for closing animation. Default values are:

    • duration = 0.3
    • dampingRatio = 0.6
    • initialVelocity = 0.8

    Declaration

    Swift

    @objc
    public lazy var closing: JJAnimationSettings { get set }

JJButtonAnimationConfiguration

  • Returns a button animation configuration that rotates the button image by given angle.

    Declaration

    Swift

    static func rotation(toAngle angle: CGFloat = -.pi / 4) -> JJButtonAnimationConfiguration

    Parameters

    angle

    The angle in radian the button will rotate to when opening.

    Return Value

    A button animation configuration object.

  • Returns a button animation configuration that transitions to a given image.

    Declaration

    Swift

    static func transition(toImage image: UIImage) -> JJButtonAnimationConfiguration

    Parameters

    image

    The image button will transition to when opening.

    Return Value

    A button animation configuration object.