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 }
-
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 }
-
A number between 0.0 and 1.0 indicating the opacity of
layer
.Declaration
var opacity: Double { get }
-
The width of
layer
s border.Declaration
var borderWidth: Double { get }
-
The corner radius applied to the corners of the
layer
s rectangular border.Declaration
var cornerRadius: Double { get }
-
The radius of
layer
s shadow.Declaration
var shadowRadius: Double { get }
-
The distance by which the shadow is offset with resepect to
layer
s 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 }
-
The content mode which determines how the contents of
image
fill the layers frame. This property only applies to layer’s of typeimage
.Declaration
var contentMode: ContentMode { get }
-
The path which represents
layer
s shape. This property only applies to layer’s of typeshape
.Declaration
var path: CompositePath { get }
-
The width of
layer
s stroke. This property only applies to layer’s of typeshape
.Declaration
var strokeWidth: Double { get }
-
The starting point of
layer
s stroke. This property only applies to layer’s of typeshape
.Declaration
var strokeStart: Double { get }
-
The end point of
layer
s stroke. This property only applies to layer’s of typeshape
.Declaration
var strokeEnd: Double { get }
-
A floating-point number that controls the miter limit ratio of
layer
s mitered line joins. This property only applies to layer’s of typeshape
.Declaration
var miterLimit: Double { 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
layer
s stroke drawing a shape layer. This property only applies to layer’s of typeshape
.Declaration
var dashPattern: Array { get }
-
The offset applied to the dash pattern when drawing
layer
s stroke. This property only applies to layer’s of typeshape
.Declaration
var dashPatternOffset: Double { get }
-
The boolean operation used to render the
layer
s final path. This property only applies to layer’s of typeshape
.Declaration
var shapeOperation: String { 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 typetext
.Declaration
var attributedString: NSMutableAttributedString? { get }
-
The text displayed by
layer
. This property only applies to layer’s of typetext
.Declaration
var string: String? { get }
-
The font size of the text displayed by
layer
. This property only applies to layer’s of typetext
.Declaration
var fontSize: Double { get }
-
The truncation scheme applied to the text displayed by
layer. This property only applies to layer's of type
text`.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 matchesid
.Declaration
func layerBy(uuid: String) -> LayerSnapshot?
Parameters
uuidThe unique identifer of the layer to search for.
Return Value
Returns the descendant layer of
self
with the given identifier, ornil
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
lhsA value.
rhsAnother value.
Return Value
true
if thelhs
andrhs
are equal,false
otherwise.