OpacityAnimator QML Type | Qt Quick 5.12.6

Qt 5.12 | Qt Quick | QML Types | OpacityAnimator QML Type

Qt 5.12.6 Reference Documentation

# OpacityAnimator QML Type

The OpacityAnimator type animates the opacity of an Item. More...

Import Statement: | import QtQuick 2.12
Since: | Qt 5.2
Inherits: | Animator

- List of all members, including inherited members

## Detailed Description

Animator types are different from normal Animation types. When using an Animator, the animation can be run in the render thread and the property value will jump to the end when the animation is complete.

The value of Item::opacity is updated after the animation has finished.

The following snippet shows how to use a OpacityAnimator together with a Rectangle item.

      Rectangle {
          id: opacityBox
          width: 50
          height: 50
          color: "lightsteelblue"
          OpacityAnimator {
              target: opacityBox;
              from: 0;
              to: 1;
              duration: 1000
              running: true
          }
      }

It is also possible to use the `on` keyword to tie the OpacityAnimator directly to an Item instance.

      Rectangle {
          width: 50
          height: 50
          color: "lightsteelblue"
          OpacityAnimator on opacity{
              from: 0;
              to: 1;
              duration: 1000
          }
      }