Skip to content

animation-tick() -> duration

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

slint
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));    }}

debug(…)

debug 函数可以接收一个或多个值作为参数,将它们打印出来,且不返回任何值。

基于 MIT 协议发布