Advertisement
tasuku

IconItem.qml

Apr 11th, 2012
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. import QtQuick 1.0
  2.  
  3. Component {
  4. Item {
  5. id: main
  6. width: grid.cellWidth; height: grid.cellHeight
  7. Rectangle {
  8. id: item; parent: loc
  9. x: main.x + 5; y: main.y + 5
  10. width: main.width - 10; height: main.height - 10;
  11. color: model.color
  12. smooth: item.state != ''
  13. Rectangle {
  14. anchors.fill: parent;
  15. border.color: "#326487"; border.width: 6
  16. color: "transparent"; radius: 5
  17. visible: item.state == "active"
  18. smooth: item.state != ''
  19. }
  20. Behavior on x { enabled: item.state != "active"; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
  21. Behavior on y { enabled: item.state != "active"; NumberAnimation { duration: 400; easing.type: Easing.OutCubic } }
  22. SequentialAnimation on rotation {
  23. NumberAnimation { to: 5; duration: 100 }
  24. NumberAnimation { to: -5; duration: 200 }
  25. NumberAnimation { to: 0; duration: 100 }
  26. running: loc.currentId != -1 && item.state != "active"
  27. loops: Animation.Infinite; alwaysRunToEnd: true
  28. }
  29. states: [
  30. State {
  31. name: "active"
  32. when: loc.currentId == gridId
  33. PropertyChanges { target: item; x: loc.mouseX - width/2; y: loc.mouseY - height/2; scale: 1.10; z: 10 }
  34. },
  35. State {
  36. when: loc.currentId != -1
  37. PropertyChanges {
  38. target: item
  39. scale: 0.75
  40. opacity: 0.75
  41. }
  42. }
  43. ]
  44. transitions: Transition { NumberAnimation { properties: "scale, opacity, x, y"; duration: 150; easing.type: Easing.OutCubic} }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement