Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to Scroll one text and other in static using qml repeater??



  • Using Number animation I can able to scroll the single text or one more text in repeater.But I want to show that a single text is on scrolling and other in static.Any suggestions.
    Here is my code

    Rectangle
    {
        id:root
        x:0
        y:0
        width:1024
        height:786
    
    Repeater{
        id:rootmodel
        model:2
    
    Text{
        id:text
        x:parent.width/2-text.width/2-xval[index]
        y:parent.height/2-text.height/2-yval[index]
        anchors.centerIn: parent.Center
        text:source[index];
        font.pointSize:200
    
        NumberAnimation on x
        {
            id:animate
            running:false
            from: root.width
            to: -1*text.width
            loops: Animation.Infinite
            duration: 16000
        }
    }
    }
    Timer{
        id:timer
        interval: 1000
        repeat: true
        running: true
        onTriggered:
        {
          if(rootmodel.count>1)
          {
              rootmodel.itemAt(0).running=true;
    
          }
    
        }
    }
    
    }
    

    Edit: Added code tags - p3c0


  • Moderators

    @Bharathi How about adding a condition in NumberAnimation itself? For eg.

    running: index==1 ? true:false //animates Item at index 1
    

Log in to reply