<Command> is used to control elements on the UI based on object names and attributes. In most cases, the visibility and animation of elements are controlled.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
target | String | Yes | Name of an object, for example, <Image name="image1"/>. The name shall be followed by a dot (.) and then attribute of the object. Currently, the visibility and animation attributes are supported. |
value | String | Yes | To control element visibility, set this parameter to true, false, or toggle, indicating visible, invisible, and inverted visibility, respectively. To control element animation, set this parameter to play or stop, indicating that the animation is played or paused. |
condition | Expression | No | Condition for command execution judgment. When the value is true or a non-0 number, the command is executed. When the value is false or 0, the command is not executed. |
delay | Number | No | Delay for executing a command, in milliseconds. |
delayCondition | Expression | No | Condition for command delay judgment. By default, when the value is true or 1, the command execution is delayed; when the value is false or a non-1 number, the command execution is not delayed. |
Control the playback or pause of an animation or the visibility of an image.
<Button x="0" y="0" h="100" w="100" >
<Trigger action="down">
<Command target="image1.visibility" value="toggle" />
<Command target="image1.visibility" value="false" />
<Command target="image1.animation" value="play"/>
<Command target="image1.animation" value="stop"/>
</Trigger>
</Button>