qt - QML Animation with both "velocity" and infinite "loops" -


i'm trying put animation in specify velocity (rather duration) , loops forever. came 2 non-working examples:

firsttry.qml

import qt 4.7  rectangle {   width: 100; height: 100   text {     text: "hello"     numberanimation on x {       to: 50;       loops: animation.infinite;       duration: 50 * math.abs(to - from)     }   } } 

i following runtime warning while hello goes nuts on screen (fair enough).

qdeclarativeexpression: expression "(function() { return 50 * math.abs(to - from) })" depends on non-notifyable properties:      qdeclarativenumberanimation::to     qdeclarativenumberanimation::from 

secondtry.qml

import qt 4.7  rectangle {   width: 100; height: 100   text {     text: "hello"     smoothedanimation on x {       to: 50;       loops: animation.infinite;       velocity: 50     }   } } 

this more of mistery -- smoothedanimation refuses loop! animation runs once , that's it.

so have following questions:

is there legal way specify velocity in first example? understand smoothedanimation derived numberanimation, maybe it's possible in qml, not in c++.

is there way make smoothedanimation loop? second example not working bug or missing something?

is there other way achieve these 2 behaviours @ same time?

just add "from" parameter explicitly:

import qt 4.7  rectangle {   width: 100; height: 100   text {     text: "hello"     numberanimation on x {       from: 0;       to: 50;       loops: animation.infinite;       duration: 50 * math.abs(to - from)     }   } } 

Comments