Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import QtQuick 2.0
SequentialAnimation {
id: root
property QtObject target
property string fadeProperty: "opacity"
property int fadeDuration: 150
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"
NumberAnimation {
id: outAnimation
target: root.target
property: root.fadeProperty
duration: root.target.visible ? root.fadeDuration : 0
to: 0
easing.type: Easing["In"+root.easingType]
}
PropertyAction { } // actually change the property between the 2 other animations
NumberAnimation {
id: inAnimation
target: root.target
property: root.fadeProperty
duration: root.target.visible ? 0 : root.fadeDuration // the duration seems to be read at the start of the SequentialAnimation or Behavior
to: 1
easing.type: Easing["Out"+root.easingType]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment