layer.states.animationOptions < object>
Set the animation options for the state machine. By default, the global animation options will be used.
译:设置状态的动画选项。默认情况下,将使用全局动画选项。
layerA = new Layer
layerA.states.add
stateA:
x: 500
opacity: 0.5
stateB:
x: 200
opacity: 1
layerA.states.animationOptions =
curve: "spring(100, 10, 0)"
layerA.states.switch("stateA")
These animation options will now be used for all state switches. To set different animation options for individual states, you can include them directly within the switch statement.
译:这些动画选项现在将被用于所有状态开关。要为单个状态设置不同的动画选项,可以直接在“开关”语句中包含它们。
# Switch to stateB with a spring curve
layerA.states.switch("stateB", curve: "spring(400, 30, 0)")
# Switch to stateB with an easing curve
layerA.states.switch("stateB", time: 1, curve: "ease")