Created
April 21, 2013 06:53
-
-
Save longlongh4/5428731 to your computer and use it in GitHub Desktop.
The way to dynamically create animation group in Qt Quick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
Rectangle{ | |
id: container | |
width: 800 | |
height: 800 | |
color: "black" | |
Rectangle{ | |
id: rect | |
width: 50 | |
height: 50 | |
} | |
MouseArea{ | |
anchors.fill: parent | |
onClicked: { | |
var childAnimationObject = Qt.createQmlObject("import QtQuick 2.1; NumberAnimation {id: animation; properties: \"x,y\"; duration: 1000; from:50; to:600; easing.type: Easing.Linear }",container) | |
childAnimationObject.target = rect | |
var paraComponent = Qt.createComponent("./ParallAnimation.qml"); | |
var list = []; | |
list.push(childAnimationObject) | |
var paraAnimation = paraComponent.createObject(container,{"animations":list}) | |
paraAnimation.start(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment