I copied some code from the Felgo website and changed it a little bit so that the animation would play once immediately when the app is launched. But for some reason it’s not working. I added running:true to the NumberAnimation so that it would start running immediately, is that not how you achieve that?
Here’s the code:
import QtQuick 2.8
import QtQml 2.2
import Felgo 3.0
App {
NavigationStack {
Page {
title: "Triggered Animation"
AppButton {
anchors.horizontalCenter: parent.horizontalCenter
text: "Spin"
flat: false
// The button is disabled while the animation is running
enabled: !animation.running
onClicked: {
// We start the animation after a button click
animation.start()
}
}
AppText {
id: label
anchors.centerIn: parent
// The text changes while the animation is running
text: animation.running? "Weeeeeeeee" : "Spin me!"
}
NumberAnimation {
running: true // This is the line I added
id: animation
target: label // The animated item id
property: "rotation" // The animated property
from: 0 // Start value. If not defined, the current value is used
to: 360 // End value
duration: 1000 // Duration of the animation
}
}
}
}