This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/ScStwSrc/resources/qml/components/FadeAnimation.qml

71 lines
2.4 KiB
QML
Raw Normal View History

2018-08-12 20:51:57 +02:00
/*
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright (C) 2018 Itsblue Development - Dorian Zeder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
SequentialAnimation {
id: root
property QtObject target
property string fadeProperty: "scale"
property int fadeDuration: 150
property int fadeDuration_in: fadeDuration
property int fadeDuration_out: fadeDuration
property alias outValue: outAnimation.to
property alias inValue: inAnimation.to
property alias outEasingType: outAnimation.easing.type
property alias inEasingType: inAnimation.easing.type
property string easingType: "Quad"
2019-05-19 14:06:05 +02:00
ParallelAnimation {
NumberAnimation { // in the default case, fade scale to 0
id: outAnimation
target: root.target
2019-05-19 14:06:05 +02:00
property: "scale"
duration: root.fadeDuration_in
to: 0.9
easing.type: Easing["In"+root.easingType]
}
NumberAnimation { // in the default case, fade scale to 0
id: outAnimation2
target: root.target
property: "opacity"
duration: root.fadeDuration_in
to: 0
easing.type: Easing["In"+root.easingType]
}
2019-05-19 14:06:05 +02:00
}
PropertyAction { } // actually change the property targeted by the Behavior between the 2 other animations
2019-05-19 14:06:05 +02:00
ParallelAnimation {
NumberAnimation { // in the default case, fade scale back to 1
id: inAnimation
target: root.target
property: root.fadeProperty
duration: root.fadeDuration_out
to: 1
easing.type: Easing["Out"+root.easingType]
}
NumberAnimation { // in the default case, fade scale to 0
id: inAnimation2
target: root.target
2019-05-19 14:06:05 +02:00
property: "opacity"
duration: root.fadeDuration_in
to: 1
2019-05-19 14:06:05 +02:00
easing.type: Easing["In"+root.easingType]
}
2019-05-19 14:06:05 +02:00
}
}