Loading files
9d2aa90beThis file is pinned to the selected release. Download the original to open it in your design tool.
import { Palette } from "std-widgets.slint";
import { Constants } from "../api.slint";
export component Spinner inherits Rectangle {
in property <bool> indeterminate: false; // Actually not supported yet.
in property <color> foreground-color: Palette.foreground.brighter(2);
property <length> size: min(self.width, self.height);
property <length> dot-size: size * 0.22;
property <[angle]> angles: [
0deg,
45deg,
90deg,
135deg,
180deg,
225deg,
270deg,
315deg,
];
property <angle> spinning-angle: 360deg * mod(animation-tick(), 1000ms) / 1000ms;
for angle in angles: Rectangle {
x: (root.width / 2) + ((size - dot-size) / 2) * sin(angle) - (dot-size / 2);
y: (root.height / 2) - ((size - dot-size) / 2) * cos(angle) - (dot-size / 2);
width: dot-size;
height: dot-size;
background: foreground-color;
opacity: mod(angle - spinning-angle, 360deg) / 360deg;
border-radius: dot-size / 2;
}
}