ColorAnimation QML Type

Animates changes in color values. 更多...

导入语句: import QtQuick .
Since: Qt Quick Ultralite 1.0



ColorAnimation is a specialized PropertyAnimation that defines an animation to be applied when a color value changes.

Here is a ColorAnimation applied to the color property of a Rectangle as a property value source. It animates the color property's value from its current value to a value of "red", over 1000 milliseconds:

import QtQuick 2.15
Rectangle {
    width: 100; height: 100
    color: "red"
    ColorAnimation on color { to: "yellow"; duration: 1000 }

Like any other animation type, a ColorAnimation 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.

For convenience, when a ColorAnimation is used in a Transition , it will animate any color properties that have been modified during the state change. If a property or properties are explicitly set for the animation, then those are used instead.

另请参阅 动画和过渡 .