LayerSnapshot

class LayerSnapshot

A LayerSnapshot represents a snapshot of a Layer at a specific point in the animation by specifying values for all of the layer’s visual properties.

  • A list of the layerSnapshot’s ancestors, ordered from oldest to youngest.

    Declaration

    var ancestors: Array<FleshedLayer> { get }
  • A list of the layerSnapshot’s descendants, ordered by depth (low to high).

    Declaration

    var descendants: Array<FleshedLayer> { get }
  • id

    The layerSnapshot’s unique identifier.

    Declaration

    var id: String { get }
  • The layerSnapshot’s type.

    Declaration

    var type: LayerType { get }
  • The layerSnapshot’s name.

    Declaration

    var name: String { get }
  • true if the layer snapshot is visible on the stage, false otherwise.

    Declaration

    var visible: Bool { get }
  • Determines the editable state of the layerSnapshot.

    Declaration

    var locked: Bool { get }
  • Determines how the layer resizes itself in relation to it’s parent.

    Declaration

    var resizingConstraint: ResizingConstraint { get }
  • The layer the layerSnapshot is a snapshot of.

    Declaration

    var layer: Layer { get }
  • The layerSnapshot’s parent, or nil if the layerSnapshot has no parent.

    Declaration

    var parent: LayerSnapshot? { get }
  • The layerSnapshot’s children.

    Declaration

    var sublayers: Array<FleshedLayer> { get }
  • A group of layers to which a mask is applied.

    Declaration

    var clippingMask: Layer? { get }
  • The position of layer.

    Declaration

    var position: Point { get }
  • A rectangle defining the size and position of layer.

    Declaration

    var bounds: Rect { get }
  • The size of layer.

    Declaration

    var size: Size { get }
  • The anchor point of layer.

    Declaration

    var anchorPoint: Point { get }
  • The angle (w.r.t. the x-axis) by which layer is rotated.

    Declaration

    var rotation: Angle { get }
  • A number between 0.0 and 1.0 indicating the opacity of layer.

    Declaration

    var opacity: Double { get }
  • The background color of layer.

    Declaration

    var backgroundColor: Color { get }
  • The width of layers border.

    Declaration

    var borderWidth: Double { get }
  • The color of layers border.

    Declaration

    var borderColor: Color { get }
  • The corner radius applied to the corners of the layers rectangular border.

    Declaration

    var cornerRadius: Double { get }
  • The color of layers shadow.

    Declaration

    var shadowColor: Color { get }
  • The radius of layers shadow.

    Declaration

    var shadowRadius: Double { get }
  • The distance by which the shadow is offset with resepect to layers position.

    Declaration

    var shadowOffset: Size { get }
  • Determines whether or not the layer is flipped about the horizontal axis passing through its anchor point. true indicates the layer is flipped.

    Declaration

    var flippedHorizontal: Double { get }
  • Determines whether or not the layer is flipped about the vertical axis passing through its anchor point. true indicates the layer is flipped.

    Declaration

    var flippedVertical: Double { get }
  • Determines whether or not layers contents including that of its sublayers is masked to its bounds. true indicates layers contents are masked.

    Declaration

    var masksToBounds: Bool { get }
  • The image displayed by layer. This property only applies to layer’s of type image.

    Declaration

    var image: Image? { get }
  • The content mode which determines how the contents of image fill the layers frame. This property only applies to layer’s of type image.

    Declaration

    var contentMode: ContentMode { get }
  • The path which represents layers shape. This property only applies to layer’s of type shape.

    Declaration

    var path: CompositePath { get }
  • The gradient used to fill layer. This property only applies to layer’s of type shape.

    Declaration

    var fillGradient: Gradient? { get }
  • The image used to fill layer. This property only applies to layer’s of type shape.

    Declaration

    var fillImage: FillImage? { get }
  • The color used to fill layer. This property only applies to layer’s of type shape.

    Declaration

    var fillColor: Color { get }
  • The color of layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var strokeColor: Color { get }
  • The width of layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var strokeWidth: Double { get }
  • The starting point of layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var strokeStart: Double { get }
  • The end point of layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var strokeEnd: Double { get }
  • A floating-point number that controls the miter limit ratio of layers mitered line joins. This property only applies to layer’s of type shape.

    Declaration

    var miterLimit: Double { get }
  • The style used to render the endpoints of layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var lineCap: LineCap { get }
  • The junction point of two stroked portions of a shape layer. This property only applies to layer’s of type shape.

    Declaration

    var lineJoin: LineJoin { get }
  • The dash pattern used to draw layers stroke drawing a shape layer. This property only applies to layer’s of type shape.

    Declaration

    var dashPattern: Array { get }
  • The offset applied to the dash pattern when drawing layers stroke. This property only applies to layer’s of type shape.

    Declaration

    var dashPatternOffset: Double { get }
  • The boolean operation used to render the layers final path. This property only applies to layer’s of type shape.

    Declaration

    var shapeOperation: String { get }
  • The layers path. This property only applies to layer’s of type path.

    Declaration

    var path: Path { get }
  • The operation used to create a Path. This property only applies to layer’s of type path.

    Declaration

    var operation: Double { get }
  • A series of points used to create a path for a mask layer. This property only applies to layer’s of type mask.

    Declaration

    var maskPath: CompositePath { get }
  • The attributed string displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var attributedString: NSMutableAttributedString? { get }
  • The text displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var string: String? { get }
  • The of the text displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var font: Font { get }
  • The font size of the text displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var fontSize: Double { get }
  • The color of the text displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var foregroundColor: Color { get }
  • The alignment applied to the text displayed by layer. This property only applies to layer’s of type text.

    Declaration

    var alignment: Alignment { get }
  • The truncation scheme applied to the text displayed by layer. This property only applies to layer's of typetext`.

    Declaration

    var truncation: Truncation { get }
  • The object’s description

    Declaration

    var description: String { get }
  • Searches for the descendant of self with the given identifier.

    Note this method may return self itself if its identifier matches id.

    Declaration

    func layerBy(uuid: String) -> LayerSnapshot?

    Parameters

    uuid

    The unique identifer of the layer to search for.

    Return Value

    Returns the descendant layer of self with the given identifier, or nil if such a layer does not exist.

  • Compares two values for equality.

    The equals function is invoked using infix notation as in the following code snippet: lhs == rhs.

    Declaration

    func equals(_ lhs: LayerSnapshot) -> Bool

    Parameters

    lhs

    A value.

    rhs

    Another value.

    Return Value

    true if the lhs and rhs are equal, false otherwise.