Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

125 lines (82 sloc) 2.97 KB

Layer

Layer.sprite

Gets the sprite to which this layer belongs.

Layer.name

Gets/sets the layer name (a string).

Layer.opacity

local opacity = layer.opacity
layer.opacity = newOpacity

Gets or sets the cel opacity. A value from 0 to 255 (which means 0=0% completely transparent, or 255=100% completely opaque).

Layer.blendMode

local blendMode = layer.blendMode
layer.blendMode = newBlendMode

Gets or sets the layer blending mode. Check the possible BlendMode values.

Layer.layers

It's a table of sub-layers if this layer is a group (Layer.isGroup), or nil if this is not a group.

Layer.parent

local spriteOrLayerGroup = layer.parent
layer.parent = sprite
layer.parent = group

Gets the sprite or the layer group which this layer belongs. You can also sets the parent to move the layer at the top of the stack of that parent.

Layer.stackIndex

local index = layer.stackIndex
layer.stackIndex = newPosition

Gets or sets the position of this layer in the stack (i.e. the index in the layer.parent.layers table). 1 means the first layer (the background layer), and bigger numbers layers that are above.

Layer.isImage

It's true if this layer has cels with images.

Layer.isGroup

It's true if this layer has sublayers inside.

Layer.isTransparent

It's true if this layer is a transparent layer (instead of a the background layer). Transparent layers have an alpha channel or, for indexed color mode, the transparent index is not visible.

Layer.isBackground

It's true if this layer is the background layer. A background layer is opaque, doesn't have alpha channel (Alpha=255 on every pixel), or in indexed color mode, the transparent index is ignored.

Layer.isEditable

Layer.isVisible

Layer.isContinuous

Layer.isCollapsed

Layer.isExpanded

Layer.cels

Returns the collection of cels of this layer. Empty if the layer is a group.

See also the Layer:cel() function.

Layer.color

local color = layer.color
layer.color = color

Gets or sets the user-defined color of this layer in the timeline.

Layer.data

local data = layer.data
layer.data = data

Gets or sets the user-defined data related to this layer (a text string).

Layer:cel()

local cel = layer:cel(frameNumber)
assert(cel == layer:cel(sprite.frames[frameNumber]))

Returns the Cel in the given frame or frameNumber (an integer). Returns nil if there is no cel in the layer/frame.

You can’t perform that action at this time.