QML----StackView动画
程序员文章站
2022-05-03 10:54:03
...
废话不多说,直接上代码(这里是渐入溅出)
StackView{
objectName: "rootStack"
id:stackView
initialItem: spalsh
anchors.fill: parent
replaceEnter: Transition {
PropertyAnimation {
target: stackView
property: "opacity"
from: 0
to: 1
duration:700
easing.type: Easing.InOutElastic;
easing.amplitude: 2.0;
easing.period: 1.5
}
}
replaceExit: Transition {
PropertyAnimation {
target: stackView
property: "opacity"
from: 1
to: 0
duration:500
easing.type: Easing.InOutElastic;
easing.amplitude: 2.0;
easing.period: 1.5
}
}
}
replace动画替换:
注意:
- Exit动画多于Enter时间会白屏。
- stackview动画尽量不要用弹性渐入溅出,导致闪屏
- enter和exit不要有太长的时间间隔。
上一篇: PHP中if判断使用逻辑非!和empty()的区别
下一篇: python中的分支判断