Results 1 to 4 of 4

Thread: QML Animation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    May 2011
    Posts
    14
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML Animation

    Hi,
    As per my understanding SequentialAnimation works on some property/attribute of QML object. For e.g. width/height of rectangle object. It keeps the property incrementing to some limit.
    But in my case the value of the property(width/height) is defined in an array. So how I can apply SequentialAnimation in this case.

    Currently I am able to create the objects dynamically but not able to show the animation.

    main.qml -
    javascript Code:
    1. import QtQuick 1.0
    2.  
    3. Rectangle {
    4. id: container
    5. width: 1500; height: 1000
    6.  
    7.  
    8. Component.onCompleted: {
    9. var component = Qt.createComponent("rectangle.qml");
    10.  
    11. // Define an array
    12. var sim_data = new Array(3); // 10 rectangles for 3 secs
    13. var t = 0;
    14. for(var i = 0;i<3;i++)
    15. sim_data[i] = new Array(10);
    16.  
    17. sim_data[0]= [0.000000,0.098023,0.192176,0.282582, 0.369357,0.452661,0.532547,0.609014,0.682063,0.751692,0.817902];
    18. sim_data[1]= [10.000000,9.900498,9.801986, 9.704455,9.607893,9.512226,9.417414,9.323457,9.230357,9.138112,9.046724];
    19. sim_data[2]= [0.000000,0.000493,0.001946,0.004321,0.007583,0.011704, 0.016680,0.022509,0.029193,0.036732];
    20.  
    21.  
    22. var col = ["red","yellow","green","blue","black"];
    23.  
    24. // working
    25.  
    26. for(var t=0; t < 3; t++)
    27. {
    28. var y = 100 * t + 150;
    29. console.log("At t = ", t);
    30.  
    31. for (var i=0; i<10; i++)
    32. {
    33. var object = component.createObject(container);
    34. object.width = sim_data[t][i] + 100;
    35. object.height = sim_data[t][i] + 100;
    36.  
    37. console.log("width = ", object.width);
    38. console.log("height = " ,object.height);
    39. object.x = 150 * i;
    40. object.y = 100;
    41. object.color = col[t];
    42. }
    43. }
    44.  
    45. }
    46. }
    To copy to clipboard, switch view to plain text mode 

    rectangle.qml -

    javascript Code:
    1. import QtQuick 1.0
    2.  
    3. Rectangle {
    4. id: rect
    5. color:"Red"
    6. }
    To copy to clipboard, switch view to plain text mode 


    Thanks.
    Last edited by wysota; 11th August 2011 at 08:13. Reason: missing [code] tags

Similar Threads

  1. Question about animation
    By franco.amato in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2010, 23:56
  2. png not support animation in QT4.6
    By sophister in forum Qt Programming
    Replies: 6
    Last Post: 10th December 2009, 13:04
  3. Animation in Qt
    By A.H.M. Mahfuzur Rahman in forum Qt Programming
    Replies: 3
    Last Post: 25th June 2009, 07:05
  4. Animation in Qt
    By yogesh884 in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2009, 09:56
  5. QPainter and Animation
    By miker in forum Qt Programming
    Replies: 4
    Last Post: 30th January 2006, 03:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.