layer.centerY(offset)

Center this layer vertically in its parent. If there is no parent it will be centered relative to the screen. The offset is a pixel offset from the center and optional.
译:中心层在超级层中的纵向。如果没有超级层将中心相对于屏幕。该偏移量是从该中心和可选的像素偏移。 参数

Arguments(参数)

offset — A number that offsets the position. 译:一个数字,偏移位置。

layerA = new Layer
    width: 500
    height: 500

layerB = new Layer
    parent: layerA
    width: 100
    height: 100

layerB.centerY()
print layerB.x, layerB.y
# Output: 0, 200 

layerB.centerY(20)
print layerB.x, layerB.y
# Output: 0, 220

results matching ""

    No results matching ""