This commit is contained in:
2025-09-28 17:05:51 +08:00
parent 8eb80ab66d
commit d97fa3e0fe
398 changed files with 18737 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
import QtQuick
Window {
width: 640
height: 480
visible: true
title: qsTr("SpringAnimation")
Rectangle{
id: containerRectId
anchors.fill: parent
color: "beige"
Rectangle{
id: containedRectId
width: 100
height: 100
x: 50
y: 50
color: "dodgerblue"
/*
Behavior on x{
SpringAnimation{
spring: 5
damping: 0.2
duration: 3000
}
}
Behavior on y{
SpringAnimation{
spring: 5
damping: 0.2
duration: 3000
}
}
*/
SpringAnimation{
id: springAnimationId
target: containedRectId
property: "x"
spring: 5
damping: 0.2
duration: 3000
}
}
MouseArea{
anchors.fill: parent
onClicked: function(mouse){
/*
containedRectId.x = mouse.x
containedRectId.y = mouse.y
*/
springAnimationId.stop()
springAnimationId.from = containedRectId.x
springAnimationId.to = mouse.x
springAnimationId.start()
}
}
}
}