mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-18 17:00:31 +08:00
5472a77c6e
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
43 lines
1.5 KiB
XML
43 lines
1.5 KiB
XML
<!-- A simple button that defines a show up animation for itself -->
|
|
<component>
|
|
<api>
|
|
<prop name="label_text" type="string" default="Click me" />
|
|
</api>
|
|
|
|
<styles>
|
|
<style
|
|
name="style_base"
|
|
bg_opa="100%"
|
|
bg_color="0x000044"
|
|
width="content"
|
|
height="content"
|
|
radius="10"
|
|
pad_hor="30"
|
|
pad_ver="20"
|
|
text_color="0xfff"
|
|
/>
|
|
|
|
<style name="style_pressed" recolor="0xfff" recolor_opa="20%" />
|
|
</styles>
|
|
|
|
<animations>
|
|
<!-- Fade in and move up
|
|
This animation can be played later in an event by a parent component or screen -->
|
|
<timeline name="show_up">
|
|
<animation target="self" prop="opa" start="0" end="255" duration="200" early_apply="true" />
|
|
<animation target="self" prop="bg_color" start="0xff0000" end="0x00ff00" duration="2000" early_apply="true" />
|
|
<animation target="self" prop="translate_y" start="20" end="0" duration="200" early_apply="true" />
|
|
<animation target="self" prop="width" start="0%" end="50%" duration="200" early_apply="true" />
|
|
</timeline>
|
|
</animations>
|
|
|
|
<view extends="lv_button">
|
|
<remove_style_all />
|
|
<style name="style_base" />
|
|
<style name="style_pressed" selector="pressed" />
|
|
|
|
<lv_label text="$label_text" align="center" />
|
|
<play_timeline_event target="self" timeline="show_up" />
|
|
</view>
|
|
</component>
|