Skip to main content
Version: 4.62

switchState

Switches between dfferent states of a layer. If multiple states are present, the action will cycle through the list. If only one state is provided, this state will be assumed.

Field Configurations

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters

KeyTypeDescriptionDefault Value
"async"BooleanSpecifies whether the action should perform asynchronously.null
"layer" (required)StringName of the layer which should switch.null
"states" (required)ArrayList of possible states to switch between.null

Inherited

From Base Action

Base Action

Field Configurations

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params"Object,ArrayObject containing the properties of the action.null
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type"StringType name of the action.null

Examples

Example 1: Switch the state of a layer

Show ExampleHide Example

Cycle between different states setting the opacity of a color layer.

{
"type": "switchState",
"params": {
"layer": "switchState01ColorLayer01",
"states": [
"100",
"50"
]
}
}
{
"type": "switchState",
"params": {
"layer": "switchState01ColorLayer01",
"states": [
"100",
"80",
"60",
"40",
"20",
"0"
]
}
}
The app showing the results of the sample code from Example 1.The app showing the results of the sample code from Example 1.