废话不多说,直接上代码(这里是渐入溅出)
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不要有太长的时间间隔。
本文探讨了QML中StackView动画的优化策略,特别是渐入溅出效果的实现,强调了避免使用弹性动画以减少闪屏现象,以及确保Enter和Exit动画时间匹配的重要性。
5983

被折叠的 条评论
为什么被折叠?



