Framer/Coffescript 条件未按预期工作

Framer/Coffescript Conditional not working as expected

逐字遵循 Framer workshop 示例,但由于某种原因无法使条件语句起作用。

此代码按预期运行

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)"

似乎 Framer API 已更新,现在必须将 .name 属性 附加到 states.current 才能正常工作。

所以下面的条件

if layerA.states.current is "grow"
    layerA.states.animationOptions = 
    curve: "ease"
    time: 2
else 
    layerA.states.animationOptions =
    curve: "spring(400,50,30)"

...会变成

if layerA.states.current.name is "grow"
    layerA.states.animationOptions = 
    curve: "ease"
    time: 2
else 
    layerA.states.animationOptions =
    curve: "spring(400,50,30)"