2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2019-09-17 16:10:59 +00:00
|
|
|
import QtQml 2.0
|
2012-01-24 01:40:02 +00:00
|
|
|
import QtQuick 2.0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: window
|
2012-02-20 00:34:44 +00:00
|
|
|
width: 320
|
|
|
|
height: 480
|
2012-01-24 01:40:02 +00:00
|
|
|
|
|
|
|
Canvas {
|
|
|
|
id: canvas
|
|
|
|
anchors.fill: parent
|
2012-07-18 03:53:40 +00:00
|
|
|
antialiasing: true
|
2012-01-24 01:40:02 +00:00
|
|
|
|
|
|
|
onPaint: {
|
2012-02-20 00:34:44 +00:00
|
|
|
var context = canvas.getContext("2d")
|
2012-01-24 01:40:02 +00:00
|
|
|
context.clearRect(0, 0, width, height)
|
|
|
|
context.strokeStyle = "black"
|
|
|
|
context.path = pathAnim.path
|
|
|
|
context.stroke()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
SequentialAnimation {
|
|
|
|
running: true
|
|
|
|
loops: -1
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
PauseAnimation { duration: 1000 }
|
2012-04-20 11:01:04 +00:00
|
|
|
//! [0]
|
2012-02-20 00:34:44 +00:00
|
|
|
PathAnimation {
|
|
|
|
id: pathAnim
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
duration: 2000
|
|
|
|
easing.type: Easing.InQuad
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
target: box
|
|
|
|
orientation: PathAnimation.RightFirst
|
|
|
|
anchorPoint: Qt.point(box.width/2, box.height/2)
|
|
|
|
path: Path {
|
|
|
|
startX: 50; startY: 50
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
PathCubic {
|
|
|
|
x: window.width - 50
|
|
|
|
y: window.height - 50
|
|
|
|
|
|
|
|
control1X: x; control1Y: 50
|
|
|
|
control2X: 50; control2Y: y
|
|
|
|
}
|
2012-01-24 01:40:02 +00:00
|
|
|
|
2012-02-20 00:34:44 +00:00
|
|
|
onChanged: canvas.requestPaint()
|
|
|
|
}
|
2012-01-24 01:40:02 +00:00
|
|
|
}
|
2012-04-20 11:01:04 +00:00
|
|
|
//! [0]
|
2012-01-24 01:40:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: box
|
|
|
|
|
|
|
|
x: 25; y: 25
|
|
|
|
width: 50; height: 50
|
|
|
|
border.width: 1
|
2012-07-18 03:53:40 +00:00
|
|
|
antialiasing: true
|
2012-01-24 01:40:02 +00:00
|
|
|
|
|
|
|
Text {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: "Box"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|