用QML制作精灵动画

时间:2014-06-20 10:03:38

标签: qt animation qml sprite

我正在尝试编写一个必须连接到Internet的小程序。在执行此操作时,应用程序应显示我在Flash Professional中制作的动画,并将其导出为精灵表。 enter image description here 我在QML中使用AnimatedSprite类型:

import QtQuick 2.2
import QtQuick.Controls 1.1

 ApplicationWindow {
    visible: true
    width: 640
    height: 480
    flags: Qt.FramelessWindowHint
           | Qt.Window
    color:"#00000000"
    title:"Presenter Remote"

Rectangle{
    color:"steelblue"
    height:parent.height
    width:parent.width
    radius: 10
}

Image {
    anchors.right: parent.right
    anchors.top: parent.top
    anchors.topMargin: -20
    scale: 0.5

    source: "close.png"
    MouseArea {
        width:parent.width
        height:parent.height
        onClicked: Qt.quit()
    }


}

AnimatedSprite{

source: "Animation_Cloud.png"
anchors.centerIn: parent
frameHeight:313
frameWidth:232
running: true
frameCount:60
frameDuration: 20
width:232
height:313


}


}

当我编译并启动时,我得到精灵动画,但它在执行时从右向左移动。 Moving sprite

如何设置精灵仍然保持"半箭头"移动?

1 个答案:

答案 0 :(得分:1)

问题似乎与你的精灵表有关;从.png。

的右侧移除多余的空间