mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
Beef up the hello.60 test case a litte with an animation
Enlarge the buttons when they're pressed.
This commit is contained in:
parent
d5c4955500
commit
bcaaa126da
1 changed files with 24 additions and 10 deletions
|
@ -23,17 +23,31 @@ component ButtonRectangle := Rectangle {
|
|||
signal clicked;
|
||||
width: 100;
|
||||
height: 75;
|
||||
TouchArea {
|
||||
width: 100;
|
||||
height: 75;
|
||||
|
||||
inner := Rectangle {
|
||||
color: root.color;
|
||||
area := TouchArea {
|
||||
width: inner.width;
|
||||
height: inner.height;
|
||||
clicked => { root.clicked() }
|
||||
}
|
||||
Text {
|
||||
x: 50;
|
||||
y: 10;
|
||||
animate x { duration: 500; }
|
||||
animate y { duration: 500; }
|
||||
x: { area.pressed ? 60 : 50; }
|
||||
y: { area.pressed ? 20 : 10; }
|
||||
text: button_text;
|
||||
color: black;
|
||||
}
|
||||
animate x { duration: 500; }
|
||||
animate y { duration: 500; }
|
||||
animate width { duration: 500; }
|
||||
animate height { duration: 500; }
|
||||
x: { area.pressed ? 0-10 : 0 }
|
||||
y: { area.pressed ? 0-10 : 0; }
|
||||
width: { area.pressed ? (root.width + 20) : root.width; }
|
||||
height: { area.pressed ? (root.height + 20) : root.height; }
|
||||
}
|
||||
}
|
||||
|
||||
Hello := Rectangle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue