目标是从屏幕中间的底部垂直向上移动按钮层,同时增长到更大的尺寸。但是,单击图层后,它不会移动到确切的中心。它向上移动但向右移动。为什么是这样?
代码
bg = new BackgroundLayer
backgroundColor: "#f39c12"
button = new Layer
width: 100
height: 100
borderRadius: 100
backgroundColor: "white"
x: Align.center
y: Align.bottom(-100)
button.on Events.Click, ->
button.states.next()
button.states =
StateA:
width: 300
height: 300
borderRadius: 300
y: Align.center