I am trying to create grid where the clicked item scales up, but if there is a previously clicked button at that scale, then the previously click button scales scales down.
So far, I have figured out how to do this by creating an invisible layer without properties, and storing the clicked layer into that, but this always requires me to create this fake layer.
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
Is there a better way?