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は、トランジション、ビヘイビア、プロパティ値のソースなど、さまざまな方法で適用できます。Animation and Transitionsのドキュメントでは、アニメーションを作成するためのさまざまな方法について説明しています。
アニメーションとトランジションも参照してください 。
列挙のドキュメント
Direction |
アニメーションの方向性のリストを提供します。
| 定数 | 説明 |
|---|---|
RotationAnimation.Numerical | 2つの数値の間を直線的に補間して回転させる。例えば、10から350までの回転は、時計回りに340度回転します。 |
RotationAnimation.Clockwise | 2つの値の間を時計回りに回転 |
RotationAnimation.Counterclockwise | 2つの値の間を反時計回りに回転 |
RotationAnimation.Shortest | 最短のアニメーションパスを生成する方向に回転します。例えば、10 から 350 までの回転は、反時計回りに 20 度回転します。 |
プロパティの説明
direction : Direction |
このプロパティは、回転の方向を保持します。
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 ライセンスの下で利用可能です。
詳細を確認してください。