我正在尝试创建网格,其中点击的项目会向上扩展,但如果之前单击的按钮处于该比例,则之前单击按钮会按比例缩小。
到目前为止,我已经想出了如何通过创建一个没有属性的不可见层,并将点击的图层存储到其中来实现这一点,但这总是需要我创建这个假图层。
background = new Layer
x:0, y:0, width:640, height:1136, image:"images/bg_gradient.png"
lastthing = new Layer
rows = 3
cols = 3
width = 160
height = 160
for row in [0..rows]
for col in [0..cols]
myCube = new Layer
x: col * (width+20)
y: row * (width+20)
Utils.labelLayer myCube, "#{col}:#{row}"
myCube.on Events.Click, (event, clickedthing) ->
Utils.labelLayer clickedthing, "clicked"
lastthing.animate
properties:
scale: 1
curve: "spring"
clickedthing.animate
properties:
scale: 1.4
curve: "spring"
lastthing = clickedthing
有更好的方法吗?