Advertisement
porloscerros

Untitled

May 24th, 2017
2,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.03 KB | None | 0 0
  1. import QtQuick 2.5
  2. import QtQuick.Controls 1.4
  3. import QtQuick.Dialogs 1.2
  4.  
  5. ApplicationWindow {
  6.     visible: true
  7.     width: 330
  8.     height: 330
  9.     title: qsTr("Transitions")
  10.  
  11.  
  12.     MainForm {
  13.         anchors.fill: parent
  14.         id: page
  15.         mouseArea1 {
  16.                    onClicked: stateGroup.state = ' '
  17.         }
  18.         mouseArea2 {
  19.             onClicked: stateGroup.state = 'State1'
  20.         }
  21.         mouseArea3 {
  22.             onClicked: stateGroup.state = 'State2'
  23.         }
  24.     }
  25.  
  26.     StateGroup {
  27.             id: stateGroup
  28.             states: [
  29.                 State {
  30.                     name: "State1"
  31.  
  32.                     PropertyChanges {
  33.                         target: page.icon
  34.                         x: page.middleRightRect.x
  35.                         y: page.middleRightRect.y
  36.                     }
  37.                 },
  38.                 State {
  39.                     name: "State2"
  40.  
  41.                     PropertyChanges {
  42.                         target: page.icon
  43.                         x: page.bottomLeftRect.x
  44.                         y: page.bottomLeftRect.y
  45.                     }
  46.                 }
  47.             ]
  48.             transitions: [
  49.                 Transition {
  50.                     from: "*"; to: "State1"
  51.                     NumberAnimation {
  52.                         easing.type: Easing.OutBounce
  53.                         properties: "x,y";
  54.                         duration: 1000
  55.                     }
  56.                 },
  57.                 Transition {
  58.                     from: "*"; to: "State2"
  59.                     NumberAnimation {
  60.                         properties: "x,y";
  61.                         easing.type: Easing.InOutQuad;
  62.                         duration: 2000
  63.                     }
  64.                 },
  65.                 Transition {
  66.                     NumberAnimation {
  67.                         easing.type: Easing.OutSine
  68.                         properties: "x,y";
  69.                         duration: 1000
  70.                     }
  71.                 }
  72.             ]
  73.      }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement