forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.slint
62 lines (56 loc) · 1.68 KB
/
scene.slint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright © SixtyFPS GmbH <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
import { VerticalBox, StyleMetrics } from "std-widgets.slint";
export component App inherits Window {
preferred-width: 500px;
preferred-height: 300px;
min-width: 500px;
min-height: 300px;
title: "Slint FFmpeg Example";
icon: @image-url("../../logo/slint-logo-small-light-128x128.png");
in property <image> video-frame <=> image.source;
in property <bool> playing;
pure callback toggle-pause-play();
VerticalBox {
image := Image {
}
}
area := TouchArea {
width: 50%;
height: self.preferred-height;
y: root.height - self.height - 40px;
controls := Rectangle {
border-radius: 4px;
background: StyleMetrics.dark-color-scheme ? #3737378c : #ffffff82;
Image {
width: 64px;
height: 64px;
source: root.playing ? @image-url("pause.svg") : @image-url("play.svg");
}
TouchArea {
clicked => {
root.toggle-pause-play();
}
}
}
}
states [
shown when area.has-hover || animation-tick() < 5s : {
controls.opacity: 1;
in {
animate controls.opacity {
duration: 50ms;
}
}
}
hidden when !area.has-hover: {
controls.opacity: 0;
in {
animate controls.opacity {
delay: 3s;
duration: 500ms;
}
}
}
]
}