diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-08-29 22:40:12 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-08-29 22:40:12 +0800 |
| commit | cadb60855b26b76b5eb0bb4b03a28b06c58eac9f (patch) | |
| tree | 003e0f80f2119a8b6fa436ff826ddd6246ddb4b6 | |
| parent | 7b7d7711ff4528bc6d045e8013b75ec0560385ef (diff) | |
IText: animate opacity
| -rw-r--r-- | components/IText.qml | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/components/IText.qml b/components/IText.qml index 8510de0..c3eb817 100644 --- a/components/IText.qml +++ b/components/IText.qml @@ -10,6 +10,7 @@ Text { property bool animate: false property real animateFrom: 0 property real animateTo: 1 + property real multiplier: 1.0 property real fontSize: Style.font.size.larger renderType: Text.NativeRendering // or Text.CurveRendering(much more expansive) or Text.QtRendering for faster @@ -29,14 +30,18 @@ Text { onTextChanged: { if (animate) { root.scale = animateFrom; + root.opacity = animateFrom; scaleAnim.to = animateTo; + opacityAnim.to = animateTo; scaleAnim.easing.bezierCurve = Style.anim.curves.standardAccel; + opacityAnim.easing.bezierCurve = Style.anim.curves.standardAccel; scaleAnim.start(); + opacityAnim.start(); } } - onLinkActivated: (link) => { - Qt.openUrlExternally(link) + onLinkActivated: link => { + Qt.openUrlExternally(link); } Behavior on color { @@ -51,8 +56,15 @@ Text { id: scaleAnim target: root property: "scale" - duration: General.animationDuration / 4 + duration: General.animationDuration / 4 / root.multiplier easing.type: Easing.BezierSpline } + NumberAnimation { + id: opacityAnim + target: root + property: "opacity" + duration: General.animationDuration / 4 / root.multiplier + easing.type: Easing.BezierSpline + } } |
