Skip to content

Instantly share code, notes, and snippets.

@oKcerG
Created August 9, 2018 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oKcerG/9a78c74808b8a652d17ce3ba98e09cf4 to your computer and use it in GitHub Desktop.
Save oKcerG/9a78c74808b8a652d17ce3ba98e09cf4 to your computer and use it in GitHub Desktop.
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