layer.centerFrame()
The calculated frame, centered within 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
print layerB.centerFrame()
# Output: { x: 200, y: 200, width: 100, height: 100 }