From cadb60855b26b76b5eb0bb4b03a28b06c58eac9f Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 29 Aug 2026 22:40:12 +0800 Subject: IText: animate opacity --- components/IText.qml | 18 +++++++++++++++--- 1 file 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 + } } -- cgit v1.2.3