2016-11-15 3 views
0

QMLのアニメーションで余白値の変更をアニメートしようとしていますが、それはできません。アニメーションは、これはqmlの余白のアニメーション

State { 
    name: "up" 
    PropertyChanges { 
     target: drag_line 
     anchors.topMargin: 50 
    } 

私の状態であると私は

​​

を試みたの移行に私も数アニメーションを試みたが、それもうまくいきませんでした。

が動作していませんどのような方法がありますが、私はプロパティがmarginではありません間違っ

答えて

2

何かをやっているが、anchors.topMargin

これは私の作業例です:

ApplicationWindow { 
    visible: true 
    width: 500 
    height: 500 

    Rectangle { 
    width: 100 
    height: 100 
    anchors.centerIn: parent 
    color: "red" 

    Rectangle { 
     id: iRect 
     color: "blue" 
     width: 40 
     height: 40 
     anchors.top: parent.top 

     states: [State { 
     name: "up" 
     when: iMouseArea.pressed 
     PropertyChanges { 
      target: iRect 
      anchors.topMargin: 50 
     } 
     }] 

     transitions: [ 
     Transition { 
      to: "up" 
      NumberAnimation { properties:"anchors.topMargin"; easing.type: Easing.InOutQuad;duration: 300 }   
     } 
     ] 
    } 

    MouseArea{ 
     id: iMouseArea 
     anchors.fill: parent 
    } 
    } 
} 
+0

完全に私のミス!指摘してくれてありがとう.. –

関連する問題