diff options
author | Juan José Casafranca <juan.casafranca@kdab.com> | 2017-09-10 14:52:46 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-10-06 12:10:05 +0000 |
commit | f0153ae8b12cc68ed6e38a1d93b83bb235b5e501 (patch) | |
tree | 311ec5c364d87ffc36b567986af3ff9823b3bbf1 /tests/manual | |
parent | c9bc1d866d69092f4fafe626687fe0f5746c829a (diff) |
Fix animation local time calculation when changing playbackRate
Animation local time was computed in absolute mode, as a scale of the
global time that has passed since the start of the animation. Now is
computed relative to the last local time, as the last local time + a
scale of the elapsed global time.
Change-Id: I5c29002602a5184174618ac7755ec94f5c7a328f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/animation-keyframe-blendtree/main.qml | 26 | ||||
-rw-r--r-- | tests/manual/animation-keyframe-simple/main.qml | 22 |
2 files changed, 44 insertions, 4 deletions
diff --git a/tests/manual/animation-keyframe-blendtree/main.qml b/tests/manual/animation-keyframe-blendtree/main.qml index 23aba4b79..3d7fa47e5 100644 --- a/tests/manual/animation-keyframe-blendtree/main.qml +++ b/tests/manual/animation-keyframe-blendtree/main.qml @@ -75,16 +75,36 @@ DefaultSceneEntity { shininess: 50 }, ObjectPicker { - onClicked: blendedAnimator.running = true + onClicked: { + if (blendedAnimator.running == false) { + blendedAnimator.running = true; + } else { + switch (pick.button) { + case PickEvent.RightButton: + animatorClock.playbackRate *= 2.0; + break; + case PickEvent.LeftButton: + animatorClock.playbackRate /= 2.0; + break; + default: + break; + } + } + } }, BlendedClipAnimator { id: blendedAnimator - loops: 2 + loops: 3 + + clock: Clock { + id: animatorClock + playbackRate: 0.5 + } onRunningChanged: console.log("running = " + running) blendTree: LerpClipBlend { - blendFactor: 0.2 + blendFactor: 0.8 startClip: ClipBlendValue { clip: AnimationClipLoader { source: "sliding-cube.json" } } diff --git a/tests/manual/animation-keyframe-simple/main.qml b/tests/manual/animation-keyframe-simple/main.qml index 79fb75fbd..9246f2467 100644 --- a/tests/manual/animation-keyframe-simple/main.qml +++ b/tests/manual/animation-keyframe-simple/main.qml @@ -75,13 +75,33 @@ DefaultSceneEntity { shininess: 50 }, ObjectPicker { - onClicked: animator.running = true + onClicked: { + if (animator.running == false) { + animator.running = true; + } else { + switch (pick.button) { + case PickEvent.RightButton: + animationClock.playbackRate *= 2.0; + break; + case PickEvent.LeftButton: + animationClock.playbackRate /= 2.0; + break; + default: + break; + } + } + } }, ClipAnimator { id: animator loops: 3 onRunningChanged: console.log("running = " + running) + clock: Clock { + id: animationClock + playbackRate: 1 + } + clip: AnimationClipLoader { source: "cubeanimation.json" onDurationChanged: console.log("duration = " + duration) |