Skip to content

全局函数

此函数返回单调递增的时间,可用于动画。 从绑定中调用此函数会不断重新求值该绑定。 可以这样使用:x: 1000px + sin(animation-tick() / 1s * 360deg) * 100px; 或 y: 20px * mod(animation-tick(), 2s) / 2s

export component Example inherits Window {
preferred-width: 100px;
preferred-height: 100px;
Rectangle {
y:0;
background: red;
height: 50px;
width: parent.width * mod(animation-tick(), 2s) / 2s;
}
Rectangle {
background: blue;
height: 50px;
y: 50px;
width: parent.width * abs(sin(360deg * animation-tick() / 3s));
}
}
slint

debug 函数可以接受一个或多个值作为参数,打印它们,并返回空。


© 2026 SixtyFPS GmbH