我想在SplashScreen上设置文本动画,但它不起作用,但这个qml动画可以工作,但大规模的动画可以工作
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import QtQuick.Layouts 1.15
Page{
id:splashPage
Component.onCompleted: {
txtAnimation.start();
}
ColumnLayout{
id:clm
anchors.fill: parent
Image {
id: icon
source: "/images/icon.png"
Layout.preferredHeight: 200
Layout.preferredWidth: 200
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: (clm.implicitHeight-icon.height)/2
}
Text{
id:txt
text: "Title under application icon"
Layout.alignment: Qt.AlignHCenter|Qt.AlignTop
}
Item {
Layout.fillHeight: true
}
}
SequentialAnimation{
id:txtAnimation
NumberAnimation {
target: txt
duration: 1000
easing.type: Easing.OutElastic
properties: "x"
from: -1000
}
SequentialAnimation {
loops: Animation.Infinite
alwaysRunToEnd: true
PauseAnimation{
duration: 600
}
PropertyAnimation {
target: txt
property: "scale"
to: 1.0
duration: 100
}
PropertyAnimation {
target: txt
property: "scale"
to: 0.85
duration: 400
}
PropertyAnimation {
target: txt
property: "scale"
to: 1
duration: 100
}
}
}
}
当我将NumberName改为Lower时,它可以工作,但在ColumnLayout中,它没有x属性
NumberAnimation {
target: txt
duration: 1000
easing.type: Easing.OutElastic
properties: "x"
from: -1000
to:25
}
我像下面这样修改了代码,但它不起作用
Text{
id:txt
text: "Title"
color: "#7f0000"
Layout.alignment: Qt.AlignHCenter|Qt.AlignTop
Behavior on x{
NumberAnimation {
duration: 1000
// easing.type: Easing.OutElastic
}
}
}