C
RotationAnimation QML Type
回転値の変化をアニメーション表示します。詳細...
| Import Statement: | import QtQuick |
| Since: | Qt Quick Ultralite 1.0 |
| Inherits: |
列挙型
プロパティ
詳細な説明
RotationAnimationは、アニメーション中の回転方向を制御できる、PropertyAnimation の特殊なインスタンスです。
デフォルトでは、数値の変化方向に沿って回転します。たとえば、0 から 240 への回転は時計回りに 240 度回転し、240 から 0 への回転は反時計回りに 240 度回転します。direction プロパティを設定することで、回転を行う方向を指定できます。
次の例では、RotationAnimation を使用して、状態間の回転を最短経路でアニメーション化しています:
import QtQuick 2.15 Rectangle { id: root color: "white" states: State { name: "rotated" PropertyChanges { target: rotation; angle: 180 } } transitions: Transition { RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise } } Text { id: text anchors.centerIn: parent text: "rotated" transform: Rotation { id: rotation angle: 0 origin.x: text.width / 2 origin.y: text.height / 2 } } MouseArea { anchors.fill: parent; onClicked: root.state = "rotated" } }
注: RotationAnimationは 、自動的に「rotation」および「angle」プロパティに限定されるわけではありません。アニメーションの対象となるプロパティを選択するには、properties またはproperty を使用してください。これはQt Quick との違いです。
他のアニメーションタイプと同様に、RotationAnimation は、トランジション、ビヘイビア、プロパティ値ソースなど、さまざまな方法で適用できます。アニメーションとトランジションに関するドキュメントでは、アニメーションを作成するためのさまざまな方法が説明されています。
「アニメーションとトランジション」も参照してください 。
列挙型のドキュメント
Direction
選択可能なアニメーションの方向の一覧を表示します。
| 定数 | 説明 |
|---|---|
RotationAnimation.Numerical | 2つの数値間を線形補間して回転させます。たとえば、10から350への回転は、時計回りに340度回転します。 |
RotationAnimation.Clockwise | 2つの値の間で時計回りに回転します |
RotationAnimation.Counterclockwise | 2つの値の間で反時計回りに回転します |
RotationAnimation.Shortest | アニメーションの経路が最も短くなる方向に回転します。たとえば、10 から 350 への回転は、反時計回りに 20 度回転します。 |
プロパティのドキュメント
direction : Direction [default]
このプロパティは、回転の方向を保持します。
from : real
このプロパティは、アニメーションの開始値を保持します。
たとえば、angle の値が100に達するまでは、次のアニメーションは適用されません:
Item { states: [ // ... ] transition: Transition { RotationAnimation { properties: "angle"; from: 100; duration: 2000 } } }
RotationAnimation がTransition またはBehavior 内で定義されている場合、この値はデフォルトで、Transition の開始状態で定義された値、またはBehavior がトリガーされた時点でのプロパティの現在の値になります。
「アニメーションとトランジション」も参照してください 。
to : real
このプロパティは、アニメーションの終了時の値を保持します。
RotationAnimation がTransition またはBehavior 内で定義されている場合、この値はデフォルトで、Transition の終了状態で定義された値、またはBehavior をトリガーしたプロパティ変更の値になります。
「アニメーションとトランジション」も参照してください 。
特定のQtライセンスで利用可能です。
詳細はこちらをご覧ください。