Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How I can quickly save QML animation to file?

    QML and Qt Quick
    2
    2
    1985
    Loading More Posts
    • 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.
    • K
      komar_rus last edited by

      I have the following QML:
      @
      import Qt 4.7

      Item {
      width: 500
      height: 500
      Text {
      id: idText1
      x: 100
      y: 100
      color: "red"
      text: "Hello word!"
      font.pixelSize: 40

          SequentialAnimation {
              running: true
              NumberAnimation {target: idText1; properties: "x"; to: 0; duration:   1000 } 
              PauseAnimation {duration: 1000 }
              NumberAnimation {target: idText1; properties: "x"; to: 100;    duration: 1000 }
          }
      }
      

      }
      @

      The animation time is 3 seconds, but I want to save the result of anymation faster than 3 second, literaly saying I want it to be saved as fast as my processor can render it.

      That is what is desired:

      @
      QGraphicsScene scene;
      QDeclarativeEngine engine;
      QDeclarativeComponent component(&engine, QUrl::fromLocalFile("QMLTest.qml"));
      QGraphicsItem *pobject = qobject_cast<QGraphicsItem *>(component.create());
      scene.addItem(pobject);

      //My Code
      scene.SetFrameRate(25.0);
      //

      for (int n = 0; n < 75; n++)
      {
      QImage qImage(500, 500, QImage::Format_ARGB32);
      QPainter qPainter(&qImage);
      scene.render(&qPainter);

      //My Code
      qAVIFileWriter.WriteImage(qImage);
      //
      }

      veiw.show();
      @

      [edit: Mark up code, Tobias Hunger]

      1 Reply Last reply Reply Quote 0
      • M
        mbrasser last edited by

        "This answer":http://developer.qt.nokia.com/forums/viewthread/1181/#5150 might be useful here are well.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post