2016-08-20 4 views
1

90%の不透明度の灰色の四角形があり、アニメーションを使ってこの不透明度を変更しようとしています。 OpacityAnimatorを使用しようとしましたが、ドキュメンテーションによると、Item :: opacityの値は、アニメーションが終了した後に更新されますQMLで不透明アニメーションを作成する

これは私が期待していたものではありません。アニメーション中の不透明度を2秒後に即座に90から0に変更するのではなく、減らしたいと考えています。私が持っているものだ

ApplicationWindow { 
    visible: true 
    width: 640 
    height: 480 
    title: qsTr("title") 
    Rectangle{ 
     width: parent.width 
     height: parent.height 
     opacity: 90 
     color: "gray" 
     id: recLoading 
     Text { 
      id: txtLoading 
      text: qsTr("Loading") 
      font.bold: true 
     } 

     OpacityAnimator on opacity{ 
      from: 90 
      to:0 
      duration:2000 
      target: parent 
      running:true 
     } 

    } 
} 

答えて

3

が間の数として指定されている0の範囲と1すなわち

... 
Rectangle{ 
    width: parent.width 
    height: parent.height 
    opacity: 0.9 
    ... 

OpacityAnimator on opacity{ 
    from: 0.9 
    to: 0.0 
    duration:2000 
    target: parent 
    running:true 
} 
+0

ああ、私は0と100の間であると思った!今それは働いている!ありがとう –

4

不透明度の間の値にあなたの不透明度の値を変更してみてください0.0(完全に透明) 1.0(完全に不透明)である。

関連する問題