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. QtQuick Gauge Needle rotation animation is not smooth

QtQuick Gauge Needle rotation animation is not smooth

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 1.0k 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.
  • P Offline
    P Offline
    prasoon1338
    wrote on last edited by
    #1

    I was trying to create a simple gauge using the QtQuick. The problem I am facing is that the needle rotation is not smooth. When the needle angle is changed for a higher value the needle not moving smoothly, there are some jerk in the motion and also feel like multiple needle moving. I tried to use most of the Animations Types and Easing types available but the result was negative.

    main.qml:-

    import QtQuick 2.0
    
    Rectangle {
    visible: true
    width: 800
    height: 800
    color: "#00000000"
    
    // My Needle
    Rectangle{
        id: id_needle
        x: 350
        y: 350
        width: 300
        height: 5
        color: "red"
        antialiasing: true
        smooth: true
        transform: Rotation {
            id: rotation
            origin.x: 3
            origin.y: 3
            angle: 0
    
            Behavior on angle {
    
                NumberAnimation{
                    duration: 1500
                    easing.type: Easing.OutQuad
                }
            }
        }
    }
    
    // Sample Timer to update needle angle
    Timer{
        id: tim
        repeat: true
        running: true
        interval: 2000
        onTriggered: {
    
            var data = Math.floor(Math.random() * 360) + 0
            rotation.angle = data
    
         }
      }
    }
    

    VIdeo and Log

    1 Reply Last reply
    1

    • Login

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