Behavior on y {
NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
Wiggly Text
Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it. It does this by assigning a complex binding to each letter:
x: follow ? follow.x + follow.width : container.width / 6
y: follow ? follow.y : container.height / 2
Then, it uses behaviors to animate the movement of each letter:
Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
Tv Tennis
Tv Tennis uses complex behaviors to make the paddles follow a ball to simulate an infinite tennis game. Again, a binding which depends on other values is applied to the position and a behavior provided the animation.
y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45;
Behavior on y { SpringAnimation{ velocity: 300 } }
Easing Curves
Easing Curves shows off all the easing curves available in Qt Quick animations.
States
States demonstrates how the properties of an item can vary between states.
It defines several states:
State {
name: "middleRight"
PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y }
State {
name: "bottomLeft"
PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y }
Transitions
Transitions takes the States example and animates the property changes by setting transitions:
transitions: [
Transition {
from: ""; to: "middleRight"
NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce; duration: 1000 }
Transition {
from: ""; to: "bottomLeft"
NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 2000 }
Transition {
NumberAnimation { properties: "x,y"; duration: 200 }
PathAnimation
PathAnimation animates an image along a bezier curve using a PathAnimation.
PathAnimation {
id: pathAnim
duration: 2000
easing.type: Easing.InQuad
target: box
orientation: PathAnimation.RightFirst
anchorPoint: Qt.point(box.width/2, box.height/2)
path: Path {
startX: 50; startY: 50
PathCubic {
x: window.width - 50
y: window.height - 50
control1X: x; control1Y: 50
control2X: 50; control2Y: y
onChanged: canvas.requestPaint()
PathInterpolator
PathInterpolator animates an image along the same bezier curve, using a PathInterpolator instead.
PathInterpolator {
id: motionPath
path: Path {
startX: 50; startY: 50
PathCubic {
x: window.width - 50
y: window.height - 50
control1X: x; control1Y: 50
control2X: 50; control2Y: y
onChanged: canvas.requestPaint()
SequentialAnimation on progress {
running: true
loops: -1
PauseAnimation { duration: 1000 }
NumberAnimation {
id: progressAnim
running: false
from: 0; to: 1
duration: 2000
easing.type: Easing.InQuad
Files: