Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Animation tekst color

Animation tekst color

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 76 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Darq
    wrote last edited by
    #1

    Is it possible to configure QML to automatically change the font size, for example, from 0 to 24 (emerging effect)? Is it also possible to automatically change the color, for example, from green to red within 3 seconds?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Although I haven't used these, I think you should check the QtQuick Animation example as a starting point.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Although I haven't used these, I think you should check the QtQuick Animation example as a starting point.

        Hope it helps

        D Offline
        D Offline
        Darq
        wrote last edited by
        #3

        @SGaist I didn't find anything related to the text in the animations.

        1 Reply Last reply
        0
        • GrecKoG Offline
          GrecKoG Offline
          GrecKo
          Qt Champions 2018
          wrote last edited by
          #4

          You can animate the font.pixelSize but it will be smoother to set a fixed pixelSize and animate the scale.

          There's ColorAnimation to animate colors.

          D 1 Reply Last reply
          1
          • GrecKoG GrecKo

            You can animate the font.pixelSize but it will be smoother to set a fixed pixelSize and animate the scale.

            There's ColorAnimation to animate colors.

            D Offline
            D Offline
            Darq
            wrote last edited by
            #5

            @GrecKo How do you animate scale? Can you give me an example?

            1 Reply Last reply
            0
            • MarkkyboyM Offline
              MarkkyboyM Offline
              Markkyboy
              wrote last edited by Markkyboy
              #6

              Hi @Darq

              Have you not looked at/for any of the QML documentation online?, there's plenty to look at, but sometimes, you will not always find directly what you want.

              I have linked ScaleAnimator QML docs page, it gives a Rectangle and a nested ScaleAnimator, swap out Rectangle for Text and get busy playing/experimenting, then you can add a ColorAnimation on the same block of code, so now you can scale text and change its color.

              Please, for yourself, do always look for documentation as most of it gives ready to paste examples to play with.

              ScaleAnimator QML ~ https://doc.qt.io/qt-6/qml-qtquick-scaleanimator.html

              ColorAnimation QML ~ https://doc.qt.io/qt-6/qml-qtquick-coloranimation.html

              I'll even throw in a quick code chunk you can play with, but documentation is the way to go, mostly.

              Text {
                      id: scalingText
                      text: "READ DOCS!"
                      color: "green"
                      anchors.centerIn: parent
                      SequentialAnimation on scale {
                          loops: Animation.Infinite
                          running: true
                          ScaleAnimator {
                              from: 2
                              to: 6
                              duration: 1000
                              easing.type: Easing.InOutQuad
                          }
                          ScaleAnimator {
                              from: 6
                              to: 2
                              duration: 1000
                              easing.type: Easing.InOutQuad
                          }
                      }
                      SequentialAnimation on color {
                          loops: Animation.Infinite
                          running: true
                          ColorAnimation {
                              to: "red"
                              duration: 4000
                          }
                          ColorAnimation {
                              to: "green"
                              duration: 4000
                          }
                      }
                  }
              

              Good luck, it's easy when you know how!

              Don't just sit there standing around, pick up a shovel and sweep up!

              I live by the sea, not in it.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved