import QtQuick 2.2
import QtQuick.Controls 1.1
Image
{
width: 240
height: 240
source: "assets/background.png"
Image
{
id: ufo
y: 90
x: 90
width: 48
height: 48
source: "assets/ufo.png"
}
ParallelAnimation
{
id: ani
NumberAnimation
{
target: ufo
properties: "width"
to: 60
duration: 600
}
NumberAnimation
{
target: ufo
properties: "height"
to: 60
duration: 600
}
}
MouseArea
{
anchors.fill: parent
onClicked:
{
ani.restart();
}
}
}
序列动画
import QtQuick 2.2
import QtQuick.Controls 1.1
Image
{
width: 240
height: 240
source: "assets/background.png"
Image
{
id: ufo
y: 90
x: 90
width: 48
height: 48
source: "assets/ufo.png"
}
SequentialAnimation
{
id: ani
NumberAnimation
{
target: ufo
properties: "width"
to: 60
duration: 600
}
NumberAnimation
{
target: ufo
properties: "height"
to: 60
duration: 600
}
}
MouseArea
{
anchors.fill: parent
onClicked:
{
ani.restart();
}
}
}