LightwellAnimationInfo

public struct LightwellAnimationInfo

A struct containing all of the info to initialize animations.

All animations have the necessary properties to determine the timing – including LightwellAnimationInfo.duration, LightwellAnimationInfo.repeatCount, and LightwellAnimationInfo.autoreverses – and how values should be combined – LightwellAnimationInfo.isAdditive and LightwellAnimationInfo.fillMode.

The type and specific values of an animation are stored in LightwellAnimationInfo.content.

  • The name of the layer, and the key for LightwellLoadingContext.animation(for:)

    Declaration

    Swift

    public var name: String?
  • Specifies the duration of the animation. Note that for a group, this will be the longest contained animation’s duration taking into account repeat counts and autoreversing.

    Declaration

    Swift

    public var duration: TimeInterval { get set }
  • Specifies how many times the animation should play through.

    Declaration

    Swift

    public var repeatCount: Float { get set }
  • Specifies wether the animation should play in reverse after getting to the end.

    Declaration

    Swift

    public var autoreverses: Bool { get set }
  • Specifies wether or not the animation’s values should replace the current state of the target layer or should be combined with all other set and animated values effecting the specified property. Note that for a group, this will always be false.

    Declaration

    Swift

    public var isAdditive: Bool { get set }
  • Fill mode for the animation values. Either forwards if the animation is meant to carry flatten the animation’s ending value to the animated layer, or not if it’s inteded to reset to the original value.

    Declaration

    Swift

    public var fillMode: CAMediaTimingFillMode
  • Specifies the type of animation, and contains all of the information needed to define the type specific values.

    Declaration

    Swift

    public var content: AnimationType
  • An enum defining all of the potential types of animations exported from Lightwell.

    Each type has different associated information to describe the contents.

    • position: corresponds to an animation with a path value effecting the position keypath of a CALayer.
    • scale: corresponds to an animation with size values effecting the transform.scale.x and transform.scale.y keypaths of a CALayer.
    • rotation: corresponds to an animation with float values effecting the transform.rotation keypath of a CALayer.
    • opacity: corresponds to an animation with float values effecting the opacity keypath of a CALayer.
    • group: corresponds to a collection of animations that are intended to be played together.
    See more

    Declaration

    Swift

    public enum AnimationType
  • Rotation values as radians around the z-axis. Values and keyTimes will be the same length (fence posts). Timing functions will be the number of times - 1 (fence slats). If the animation had targets specified, the targets will have the corresponding views in the containing loading context’s LightwellLoadingContext.views property.

    Declaration

    Swift

    public typealias LightwellRotationKeyframes = (values: [CGFloat], keyTimes: [NSNumber], timingFunctions: [CAMediaTimingFunction], targets: [UIView]?)
  • Alpha are normalized to a 0.0 as fully transparent and 1.0 as fully opaque scale. Values and keyTimes will be the same length (fence posts). Timing functions will be the number of times - 1 (fence slats). If the animation had targets specified, the targets will have the corresponding views in the containing loading context’s LightwellLoadingContext.views property.

    Declaration

    Swift

    public typealias LightwellAlphaKeyframes = (values: [CGFloat], keyTimes: [NSNumber], timingFunctions: [CAMediaTimingFunction], targets: [UIView]?)
  • Scales are values on a 0.0 as scaling to a size of 0.0 and 1.0 scaling to original content size scale. Values and keyTimes will be the same length (fence posts). Timing functions will be the number of times - 1 (fence slats). If the animation had targets specified, the targets will have the corresponding views in the containing loading context’s LightwellLoadingContext.views property.

    Declaration

    Swift

    public typealias LightwellScaleKeyframes = (values: [CGSize], keyTimes: [NSNumber], timingFunctions: [CAMediaTimingFunction], targets: [UIView]?)
  • Position values are stored as a bezier path. The number of path segments and keyTimes will be the same (fence posts). Timing functions will be the number of times - 1 (fence slats). If the animation had targets specified, the targets will have the corresponding views in the containing loading context’s LightwellLoadingContext.views property.

    Declaration

    Swift

    public typealias LightwellPositionPaths = (path: UIBezierPath, keyTimes: [NSNumber], timingFunctions: [CAMediaTimingFunction], targets: [UIView]?)