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. [Solved] I want to change x axis of image:

[Solved] I want to change x axis of image:

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 2.2k Views
  • 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
    DanSiddiqui
    wrote on last edited by
    #1

    I implement following code in qt qml:
    @
    Image {
    id: img
    x: 0
    y: 19
    source: "images/bubble.png"

        SequentialAnimation on y {
            loops: Animation.Infinite
            NumberAnimation { from:10;  to: 640; easing.type: Easing.InCirc; duration: 8000 }
            PauseAnimation { duration: 200 }
        }
    
    
    }
    

    @

    after completing animation on y axis i want to generate random number and pass it to the x of the image plz help;

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      Your animation wont finish. Its infinite. I suppose you want to change x after Number or Pause animation. You can use "ScriptAction":http://doc.qt.nokia.com/4.7-snapshot/qml-scriptaction.html

      @
      ScriptAction {
      script: img.x = Math.random() * MaxX
      }
      @

      where MaxX is maximum x value that picture can have.

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • D Offline
        D Offline
        DanSiddiqui
        wrote on last edited by
        #3

        Thanks task_struct:
        its workinggggggg :)

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DanSiddiqui
          wrote on last edited by
          #4

          One more thing task_struct it is posible to set animated gif as a background in my qml page.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            task_struct
            wrote on last edited by
            #5

            Yes. See "AnimatedImage":http://doc.qt.nokia.com/4.7-snapshot/qml-animatedimage.html

            "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

            • Linu...
            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