1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
import QtQuick 2.15
import QtQuick.Window 2.15
Rectangle {
width: 100
height: 100
visible: true
color: "blue"
property bool onFinishedCalled : false;
property bool onStoppedCalled : false;
property int loopsMade: 0;
Rectangle {
id: whiteRect
objectName: "whiteRect"
anchors.fill: parent
color: "white"
opacity: 1
}
property var seqAnim : SequentialAnimation {
loops: Animation.Infinite
alwaysRunToEnd: true
NumberAnimation {
target: whiteRect
properties: "opacity"
from: 1;
to: 0.1;
duration: 500
}
NumberAnimation {
target: whiteRect
properties: "opacity"
from: 0.1;
to: 1;
duration: 500
}
ScriptAction {
script: loopsMade++
}
onFinished: {
whiteRect.opacity = 1
onFinishedCalled = true
}
onStopped : {
whiteRect.opacity = 1
onStoppedCalled = true
}
onStarted:{
onFinishedCalled = false
onStoppedCalled = false
loopsMade = 0
}
}
}
|