逐字遵循 Framer 研讨会示例,由于某种原因无法使条件语句起作用。
此代码按预期运行
layerA = new Layer
backgroundColor: "#fff"
borderRadius: 4
width: 200
height: 200
rotation: 0
layerA.center()
layerA.states.add
grow:
scale: 1.5
rotation: 90
shrink:
scale: 1
rotation: 0
layerA.states.animationOptions =
curve: "spring(400, 50, 30)"
layerA.onClick ->
layerA.states.next("grow", "shrink")
但是,如果我在下面添加条件,它会被忽略吗?
if layerA.states.current is "grow"
layerA.states.animationOptions =
curve: "ease"
time: 2
else
layerA.states.animationOptions =
curve: "spring(400,50,30)"