How QML cycle sprites?
-
well a "quick" search show-me "this":http://doc.qt.nokia.com/4.7/qml-animatedimage.html
-
It will help you only if you have ready gif file. If you have animation in one jpg file or if you multiple files (one for each frame) it will not help you
-
ups, sorry, just a mistake. i mean clip. works like this:
@import Qt 4.7
Rectangle {
id:screen
width:1024
height:600
Item{
id:spriteAnimation
property int framesCount:8
property int currentFrame:0anchors.centerIn:parent clip:true height:spriteAnimationImage.height width:spriteAnimationImage.width/framesCount Image{ id:spriteAnimationImage source:"http://chikuyonok.ru/u/2009/05/elephant.jpg" y:0 x:-spriteAnimation.width*spriteAnimation.currentFrame } } Timer{ id:spriteAnimationTimer interval:50 running:true repeat:true onTriggered:{ spriteAnimation.currentFrame++ spriteAnimation.currentFrame%=spriteAnimation.framesCount } }
}
@