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. Apply rotation to an item multiple items
Forum Updated to NodeBB v4.3 + New Features

Apply rotation to an item multiple items

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 647 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.
  • R Offline
    R Offline
    Ronak5
    wrote on last edited by
    #1

    Hi ,

    I want to apply 'rotation' property to an image in different angles to give different view everytime. So, how do I apply rotation 'n' times to an image.

        transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: 20}
        transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: -30}
    

    If i try multiple times to apply the property in qml, it gives error of "Duplicate property binding (M10)".

    ODБOïO 1 Reply Last reply
    0
    • R Ronak5

      Hi ,

      I want to apply 'rotation' property to an image in different angles to give different view everytime. So, how do I apply rotation 'n' times to an image.

          transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: 20}
          transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: -30}
      

      If i try multiple times to apply the property in qml, it gives error of "Duplicate property binding (M10)".

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      Hi, don't define 'transform' 2 times, just change 'angle' property

      transform: Rotation {id:myR origin.x: image.width/2; origin.y: image.height/2; angle: 20}
      ..
      myR.angle = -30

      R 1 Reply Last reply
      1
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3
        Timer{
                onTriggered: theRotation.angle = Math.random()*360
                interval: 1000//1s
                running: true
                repeat: true
        
            }
        
            Image{
                id:img
                anchors.centerIn: parent
                height: sourceSize.height
                width: sourceSize.width
                source:"GUI/img/icon5.png"
                transform: Rotation{
                     id: theRotation
                     origin.x: img.width/2; origin.y: img.height/2; angle: 20
                    Behavior on angle {
                        NumberAnimation{
                            duration: 200
                        }
                    }
                }
            }
        
        1 Reply Last reply
        0
        • ODБOïO ODБOï

          Hi, don't define 'transform' 2 times, just change 'angle' property

          transform: Rotation {id:myR origin.x: image.width/2; origin.y: image.height/2; angle: 20}
          ..
          myR.angle = -30

          R Offline
          R Offline
          Ronak5
          wrote on last edited by
          #4

          @LeLev
          hey, I tried this but it throws error of "invalid property name".

          ODБOïO 1 Reply Last reply
          0
          • R Ronak5

            @LeLev
            hey, I tried this but it throws error of "invalid property name".

            ODБOïO Offline
            ODБOïO Offline
            ODБOï
            wrote on last edited by
            #5

            @Ronak5 hi, as we solved your issue you can mark this as solved

            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