Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
animations.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
/*!
4
\page qtquick-usecase-animations.html
5
\meta {keywords} {qmltopic}
6
\title Animations
7
\keyword Use case - Animations In QML
8
\brief Example of how to include animations in QML applications
9
10
\l {Qt Quick} provides the ability to animate properties. Animating properties
11
allows property values to move through intermediate values instead of
12
immediately changing to the target value. To animate the position of an item,
13
you can animate the properties that control the item's position, x and y for
14
example, so that the item's position changes each frame on the way to the
15
target position.
16
17
\section1 Fluid UIs
18
19
QML was designed to facilitate the creation of fluid UIs. These are user
20
interfaces where the UI components animate instead of appearing, disappearing,
21
or jumping abruptly. Qt Quick provides two simple ways to have UI components
22
move with animation instead of instantly appearing at their new location.
23
24
\section2 States and transitions
25
26
Qt Quick allows you to declare various UI states in \l State objects. These
27
states are comprised of property changes from a base state, and can be a useful
28
way of organizing your UI logic. Transitions are objects you can associate with
29
an item to define how its properties will animate when they change due to a
30
state change.
31
32
States and transitions for an item can be declared with the \l Item::states and
33
\l Item::transitions properties. States are declared inside the states list
34
property of an item, usually the root item of the component. Transitions
35
defined on the same item are used to animate the changes in the state. Here is
36
an example.
37
38
\snippet qmlapp/usecases/animations.qml states
39
40
\section2 Animating property changes.
41
42
Behaviors can be used to specify an animation for a property to use when it
43
changes. This is then applied to all changes, regardless of their source. The
44
following example animates a button moving around the screen using behaviors.
45
46
\snippet qmlapp/usecases/animations.qml behave
47
48
\section1 Other animations
49
50
Not all animations have to be tied to a specific property or state. You can
51
also create animations more generally, and specify target items and properties
52
inside the animation. Here are some examples of different ways to do this:
53
54
\snippet qmlapp/usecases/animations.qml constant
55
\snippet qmlapp/usecases/animations.qml scripted
56
\image qmlapp/qml-uses-animation.png
57
58
More information about animations can be found on the
59
\l{Important Concepts in Qt Quick - States, Transitions and Animations} page.
60
61
*/
qtdeclarative
src
quick
doc
src
getting-started
animations.qdoc
Generated on
for Qt by
1.16.1