layer.center()
Center this layer in its parent. If there is no parent, it will be centered relative to the screen.
译:这层在超级层的中心。如果没有超级层,它将以屏幕为中心。
layerA = new Layer
width: 500
height: 500
layerB = new Layer
parent: layerA
width: 100
height: 100
layerB.center()
print layerB.x, layerB.y
# Output: 200, 200