This component supports switch between three screens and animation transition between switching. You can draw content on a screen using <Rectangle> and <Image>.
<Group x="">
<!--Screen 1-->
<Group x="">
<Rectangle x="" y="" w="" h="" fillColor="" />
<!--<Image y="" alignV="" src="" />-->
</Group>
<!--Screen 2-->
<Group x="">
<Rectangle x="" y="" w="" h="" fillColor="" />
<!--<Image y="" alignV="" src="" />-->
</Group>
<!--Screen 3-->
<Group x="">
<Rectangle x="" y="" w="" h="" fillColor="" />
<!--<Image y="" alignV="" src="" />-->
</Group>
</Group> Parameter | Type | Mandatory | Description |
|---|---|---|---|
Group | Expression | Yes | Element group. The x attribute indicates the start X coordinate of the screen. |
Rectangle | Expression | No | Rectangle type, which can be used to draw content on a screen. For details about related parameters, please refer to <Geometrical figure>. |
Image | Expression | No | Image type, which can be used to draw content on a screen. For details about related parameters, please refer to <Image>. |
Examples
Example 1: Use Rectangle to draw content on a screen, use fillColor to distinguish three screens by color, use dottedLine to specify the dotted line mode, and use cornerRadius to specify the corner radius of a rectangle. For details about related parameters, please refer to <Geometrical figure>. Swipe left or right to switch between three screens.
<!--Swipe to switch between three screens.-->
<Var name="move_go">
<VariableAnimation initPause="true" loop="false">
<AniFrame value="#move1" time="0" varSpeedFlag="QuartFun_Out" />
<AniFrame value="#move2" time="200" />
</VariableAnimation>
</Var>
<Var name="base" expression="0"/>
<Var name="move" expression="#touch_x-#touch_begin_x"/>
<Var name="temp" expression="#base+#move"/>
<Var name="maxvalue" expression="500*#screen_width/1080"/>
<Var name="value" expression="ifelse(lt(#temp,-#maxvalue),-#maxvalue,gt(#temp,#maxvalue),#maxvalue,#temp)"/>
<Var name="scalevalue" expression="#value/#maxvalue"/>
<ExternalCommands>
<Trigger action="resume">
<Command target="a.visibility" value="true"/>
</Trigger>
<Trigger action="pause">
<Command target="a.visibility" value="false"/>
</Trigger>
</ExternalCommands>
<!--Determine whether to swipe left or right.-->
<Button x="0" y="120" w="1080" h="#screen_height">
<Trigger action="down">
<VariableCommand name="move1" expression="#move2+#touch_x-#touch_begin_x" />
<VariableCommand name="move2" expression="max(min(#move2+#zf_end*1080,1080),-1080)" />
<Command target="move_go.animation" value="play" />
</Trigger>
<Trigger action="up">
<VariableCommand name="base" expression="#value"/>
<VariableCommand name="move" expression="0"/>
</Trigger>
</Button>
<Group name="a" x="#scalevalue*ifelse(lt(#scalevalue,0),1080,1080)" >
<!--Screen 1-->
<Group x="-1080" >
<Rectangle x="0" y="0" w="1080" h="1920" fillColor="#b6937c" dottedLine="20,10,10,20" cornerRadius="55,55"/>
</Group>
<!--Screen 2-->
<Group x="0" >
<Rectangle x="0" y="0" w="1080" h="1920" fillColor="#ae6b5a" dottedLine="20,10,10,20" cornerRadius="55,55"/>
</Group>
<!--Screen 3-->
<Group x="1080" >
<Rectangle x="0" y="0" w="1080" h="1920" fillColor="#59493f" dottedLine="20,10,10,20" cornerRadius="55,55"/>
</Group>
</Group> Example 2: Use three different images as screens and swipe left or right to switch between the three screens.
<!--Swipe to switch between three screens.-->
<Var name="move_go">
<VariableAnimation initPause="true" loop="false">
<AniFrame value="#move1" time="0" varSpeedFlag="QuartFun_Out" />
<AniFrame value="#move2" time="200" />
</VariableAnimation>
</Var>
<Var name="base" expression="0"/>
<Var name="move" expression="#touch_x-#touch_begin_x"/>
<Var name="temp" expression="#base+#move"/>
<Var name="maxvalue" expression="500*#screen_width/1080"/>
<Var name="value" expression="ifelse(lt(#temp,-#maxvalue),-#maxvalue,gt(#temp,#maxvalue),#maxvalue,#temp)"/>
<Var name="scalevalue" expression="#value/#maxvalue"/>
<ExternalCommands>
<Trigger action="resume">
<Command target="a.visibility" value="true"/>
</Trigger>
<Trigger action="pause">
<Command target="a.visibility" value="false"/>
</Trigger>
</ExternalCommands>
<!--Determine whether to swipe left or right.-->
<Button x="0" y="120" w="1080" h="#screen_height">
<Trigger action="down">
<VariableCommand name="move1" expression="#move2+#touch_x-#touch_begin_x" />
<VariableCommand name="move2" expression="max(min(#move2+#zf_end*1080,1080),-1080)" />
<Command target="move_go.animation" value="play" />
</Trigger>
<Trigger action="up">
<VariableCommand name="base" expression="#value"/>
<VariableCommand name="move" expression="0"/>
</Trigger>
</Button>
<Group name="a" x="#scalevalue*ifelse(lt(#scalevalue,0),1080,1080)" >
<!--Screen 1-->
<Group x="-1080">
<Image y="#screen_height" alignV="bottom" src="screen1.png" />
</Group>
<!--Screen 2-->
<Group x="0">
<Image y="#screen_height" alignV="bottom" src="screen2.jpg"/>
</Group>
<!--Screen 3-->
<Group x="1080">
<Image y="#screen_height" alignV="bottom" src="screen3.jpg"/>
</Group>
</Group>