-
Notifications
You must be signed in to change notification settings - Fork 0
2.12
Explanation of the contents of a topic page @ Week 1 Topic 1
Objective: Basic animation
- What does "easing curve" mean?
- What is Behaviour?
- When does Behaviour animate an item property?
- When does the animation start?
- When does the animation finish?
- What is an easing curve?
- How do you define non-linear animations?
Comment: What is an easing curve (or how to define non-linear animations, it would be nice to show/mention Qt Quick Toolbar in Qt Creator QML editor?)
K: I have completely missed the light bulbs so I think the toolbars should be mentioned sooner somewhere too https://doc.qt.io/qtcreator/qt-quick-toolbars.html
http://doc.qt.io/qt-5/qml-qtquick-behavior.html#details
A Behavior defines the default animation to be applied whenever a particular property value changes.
For example, the following Behavior defines a NumberAnimation to be run whenever the Rectangle's width value changes. When the MouseArea is clicked, the width is changed, triggering the behavior's animation:
import QtQuick 2.0
Rectangle {
id: rect
width: 100; height: 100
color: "red"
Behavior on width {
NumberAnimation { duration: 1000 }
}
MouseArea {
anchors.fill: parent
onClicked: rect.width = 50
}
}
Note that a property cannot have more than one assigned Behavior. To provide multiple animations within a Behavior, use ParallelAnimation or SequentialAnimation.
If a state change has a Transition that matches the same property as a Behavior, the Transition animation overrides the Behavior for that state change. For general advice on using Behaviors to animate state changes, see Using Qt Quick Behaviors with States.
E: I copied this from the link in the description. States and transitions don't appear until 2.14, and there's alot of talk about the states and transitions in the text. Should this text be redone somehow or should we put states and transitions before Behavior?
Tino: Quite a corner case in my opinion. I did not even know this. Who would use both at the same time? I would put this piece of text to the section, where we talk about states and transitions. Actually, it's there in the end of 2.14 already.