QML----StackView动画

废话不多说,直接上代码(这里是渐入溅出)

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动画替换:

注意:

  1. Exit动画多于Enter时间会白屏。
  2. stackview动画尽量不要用弹性渐入溅出,导致闪屏
  3. enter和exit不要有太长的时间间隔。

你可能感兴趣的:(QML)