[Interest] [Qt3d] Does the duration of NumberAnimation update when you change its value?

Oleg Evseev ev.mipt at gmail.com
Tue Apr 26 21:27:16 CEST 2016

Hi, Ramy and Sean

> Something like this should do it (not tested)

Thank you, Sean. Correct it little bit, tested, it works:

Entity {

        id: mainEntity

        property real progress: 0.0

        property real rotationSpeed: -1.0

        property real angle: previousAngle + ( progress * 360.0 *
rotationSpeed  )

        property real previousAngle: 0.0

        function updatePreviousRotation() {

            mainEntity.previousAngle = mainEntity.angle % 360;


        TorusMesh { id: mesh; radius: 5; minorRadius: 1; rings: 100;
slices: 20 }

        PhongMaterial { id: material }

//for some reason in this test project using just "angle" leads to
// but in another project it's all right to use Entity properties in
Transform without Entity id

        Transform {id: transform; rotation:  fromEulerAngles(0,
mainEntity.angle, 0) }

        SequentialAnimation {

            running: true

            loops: Animation.Infinite

            NumberAnimation {

                target: mainEntity; property: "progress"

                from: 0.0; to: 1.0

                duration: 1000


            ScriptAction {

                script: {


                    mainEntity.rotationSpeed += 0.1;



        components: [ mesh, material, transform ]    }

rotationSpeed defines cycles per second.

But now I have another related question. To compute rotationSpeed from
vehicle linear speed one needs wheel radius. If I use different vehicle
models with distinct size of wheels, I need to know sizes of a mesh
(something like size of 3d model collision box).
Is there a way to get mesh cube size?

Regards, Oleg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160426/cbe496cf/attachment.html>

More information about the Interest mailing list