# Create a layerlayerA =x: 0y: 0width: 100height: 100
A layers position, size and looks are defined by its properties. Besides being able to define an image, background, or video, you can also transform, hide layers, scale layers and more.
layerB =backgroundColor: "#2DD7AA"width: 60height: 60scale: 1borderRadius: 3
You can also define and override properties after having created a layer.
layerB.borderRadius = 3layerB.rotation = 45layerB.opacity = 0.8layerB.scale = 0.8
A layer can be positioned with its x and y properties. These values define the distance from the top-left corner of the canvas. The minX, minY, midX, midY, maxX and maxY values can also be used to position a layer.
# Properties of layerA# x:40, y:40, width:80layerB.x = layerAx # 40layerB.x = layerAminX # 40layerB.x = layerAmaxX # 120
The distance from the top-left corner of the canvas to the center of a layer can be calculated with midX and midY.
# The x value of the centerlayerB.x = layerAmidX # 80# The y value of the centerlayerB.y = layerAmidY # 80
You can center a layer within its superLayer (see Hierarchy), or on the screen by calling the center() function. Layers can also be exclusively centered horizontally or vertically.
# CenterlayerAcenter# Center horizontallylayerAcenterX# Center verticallylayerAcenterY
Layers can have a parent and/or children. Parent layers are called superLayers, and child layers are called subLayers. Layers inherit properties from their superLayers.
# Two ways to define hierarchylayerB.superLayer = layerAlayerAaddSubLayerlayerB
Layers can contain images, videos and text.
# Layer with imagelayerA =image:"image.png"
# Layer with videolayerA =video: "video.mp4"
# Layer with HTMLlayerA =layerA.html ="Hello"