Results 1 to 1 of 1

Thread: Image masks alternative for QML items

  1. #1
    Join Date
    Dec 2011
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Arrow Image masks alternative for QML items

    Please advise image masks alternative approach for QML items.

    I have:

    1. Root rectangle with gradient ( Yellow to red and vice versa )
    2. On screen rectangle (anchors.fill: parent) with gradient from "#0000FF" to "#ff00ff"
    3. 64x64 Green rectangle (moving by y)
    4. Text
    5. ... possible any other items

    I need to combine them together like picture below!
    Something similar does image mask in sprite animation.
    So, The result should be: Moving rectangle 64x64 with color change from "#0000FF" to "#ff00ff" and "TST" title on it.

    Could you advise me which methods in QML is the best for this transformation?



    Qt Code:
    1. Rectangle {
    2. width: 256
    3. height: 256
    4. id: root
    5.  
    6. SequentialAnimation on color {
    7. loops: Animation.Infinite
    8. ColorAnimation { from: "yellow"; to: "red"; duration: 4000 }
    9. ColorAnimation { from: "red"; to: "yellow"; duration: 4000 }
    10. }
    11.  
    12. Rectangle {
    13. anchors.fill: parent
    14. id: item1
    15.  
    16. SequentialAnimation on color {
    17. id: anime;
    18. loops: Animation.Infinite
    19. ColorAnimation { from: "#0000FF"; to: "#ff00ff"; duration: 2000 }
    20. ColorAnimation { from: "#ff00ff"; to: "#0000FF"; duration: 2000 }
    21. }
    22. }
    23.  
    24. Item {
    25. id: mask
    26. anchors.fill: parent
    27.  
    28. Rectangle {
    29. id: item2
    30. color: "green"
    31. width: 64; height: 64; x: 10
    32.  
    33. SequentialAnimation on y {
    34. running: true
    35. loops: Animation.Infinite
    36. NumberAnimation {
    37. to: root.height-64
    38. duration: 2000
    39. }
    40. NumberAnimation {
    41. to: 0
    42. duration: 2000
    43. }
    44. }
    45. }
    46. }
    47.  
    48. Text {
    49. id: text1
    50. parent: item2
    51. text: "TST"
    52. color: "yellow"
    53. font.pointSize: 10
    54. }}
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by klep; 7th July 2014 at 20:33.

Similar Threads

  1. php preg_match_all Qt alternative
    By alrawab in forum Newbie
    Replies: 8
    Last Post: 23rd June 2014, 23:23
  2. Is there a C++ alternative to QML/Qt Quick?
    By Awareness in forum Newbie
    Replies: 6
    Last Post: 30th April 2013, 23:57
  3. accepted() alternative
    By hojoff79 in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2011, 02:19
  4. QTableWidgetItem and formatting / input masks
    By Walter in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2007, 13:39
  5. alternative to COM??
    By TheKedge in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 15:02

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.