0
按照Framer研討會的例子逐字逐句地,由於某種原因無法獲得有條件的聲明。成幀器/ Coffescript有條件的不按預期方式工作
此代碼運行正常
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)"
你可以閱讀更多關於動畫的API的變化這裏:https://github.com/koenbok/Framer/wiki /動畫升級指南 – Niels
@Niels:這將是未來的優秀參考,謝謝。 – counselor