Animates changes in qreal-type values. 更多...
导入语句: | import QtQuick . |
Since: | Qt Quick Ultralite 1.0 |
继承: | |
继承者: |
NumberAnimation is a specialized PropertyAnimation that defines an animation to be applied when a numerical value changes.
Here is a NumberAnimation applied to the
x
property of a
Rectangle
as a property value source. It animates the
x
value from its current value to a value of 50, over 1000 milliseconds:
import QtQuick 2.15 Rectangle { width: 100; height: 100 color: "red" NumberAnimation on x { to: 50; duration: 1000 } }
Like any other animation type, a NumberAnimation can be applied in a number of ways, including transitions, behaviors and property value sources. The 动画和过渡 documentation shows a variety of methods for creating animations.
另请参阅 动画和过渡 .
from : real |
This property holds the starting value for the animation.
For example, the following animation is not applied until the
x
value has reached 100:
Item { states: [ // ... ] transition: Transition { NumberAnimation { properties: "x"; from: 100; duration: 200 } } }
若 NumberAnimation is defined within a Transition or 行为 , this value defaults to the value defined in the starting state of the Transition , or the current value of the property at the moment the 行为 is triggered.
另请参阅 动画和过渡 .
to : real |
This property holds the end value for the animation.
若 NumberAnimation is defined within a Transition or 行为 , this value defaults to the value defined in the end state of the Transition , or the value of the property change that triggered the 行为 .
另请参阅 动画和过渡 .