layer.states.add(name, states)
Adds a layer state. Each layer state is a collection of layer properties and values. You can add them one by one with a name and property object or all at once with an object containing the layer names and properties.
There is always a "default" state, containing the property values that the layer was created with.
译:添加一个图层状态。每一层状态是一个层属性和值的集合。您可以添加一个由一个名称和属性对象或所有在一次与一个对象包含的层名称和属性。
总是有一个“默认”状态,包含该层创建的属性值。
Arguments(参数)
name— A string that is the title of the state. 译:一个字符串,是状态的标题states— A collection of objects with layer properties and values. 译:具有层属性和值的对象的集合。
layerA = new Layer
# Add a single state
layerA.states.add
stateA:
x: 500
opacity: 0.5
# Add a multiple states
layerA.states.add
stateA:
x: 500
opacity: 0.5
stateB:
x: 200
opacity: 1