/ widgets / StyledText.qml
StyledText.qml
 1  pragma ComponentBehavior: Bound
 2  
 3  import "root:/services"
 4  import "root:/config"
 5  import QtQuick
 6  
 7  Text {
 8      id: root
 9  
10      property bool animate: false
11      property string animateProp: "scale"
12      property real animateFrom: 0
13      property real animateTo: 1
14      property int animateDuration: Appearance.anim.durations.normal
15  
16      renderType: Text.NativeRendering
17      textFormat: Text.PlainText
18      color: Colours.palette.m3onSurface
19      font.family: Appearance.font.family.sans
20      font.pointSize: Appearance.font.size.smaller
21  
22      Behavior on color {
23          ColorAnimation {
24              duration: Appearance.anim.durations.normal
25              easing.type: Easing.BezierSpline
26              easing.bezierCurve: Appearance.anim.curves.standard
27          }
28      }
29  
30      Behavior on text {
31          enabled: root.animate
32  
33          SequentialAnimation {
34              Anim {
35                  to: root.animateFrom
36                  easing.bezierCurve: Appearance.anim.curves.standardAccel
37              }
38              PropertyAction {}
39              Anim {
40                  to: root.animateTo
41                  easing.bezierCurve: Appearance.anim.curves.standardDecel
42              }
43          }
44      }
45  
46      component Anim: NumberAnimation {
47          target: root
48          property: root.animateProp
49          duration: root.animateDuration / 2
50          easing.type: Easing.BezierSpline
51      }
52  }