[英]How to use AnimeJS library on QML
在 Qt Creator 中,我創建了QT Quick Application並使用此鏈接github ,但使用這種方式:
import "qrc:/anime-master/lib/anime.js" as Logic
Window {
visible: true
width: 640
height: 480
title: qsTr("JS")
Rectangle{
id: rec1
width: 100; height: width
color: "orange"
x: 200; y: 250
MouseArea{
anchors.fill: parent
onClicked: {
getAnime()
}
}
}
function getAnime(){
Logic.anime({
targets: rec1,
translateX: 320
});
}
}
但我有這個錯誤:
qrc:/anime-master/lib/anime.js:1283: ReferenceError: module is not defined
in its file: module.exports = anime;
我對js的了解很少
簡單答案:您應該使用QML 的內部動畫工具。
更詳細的答案:
setTimeout()
function。QML中根本就沒有這樣的function。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.