diff options
Diffstat (limited to 'src/utilities/animatedValue.vala')
-rw-r--r-- | src/utilities/animatedValue.vala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/utilities/animatedValue.vala b/src/utilities/animatedValue.vala index 32ab889..7acc7a7 100644 --- a/src/utilities/animatedValue.vala +++ b/src/utilities/animatedValue.vala @@ -116,10 +116,16 @@ public class AnimatedValue : GLib.Object { ///////////////////////////////////////////////////////////////////// public void reset_target(double end, double duration) { - this.start = this.val; this.end = end; this.duration = duration; - this.state = 0.0; + this.start = this.val; + + if (duration == 0.0) { + this.val = end; + this.state = 1.0; + } else { + this.state = 0.0; + } } ///////////////////////////////////////////////////////////////////// @@ -129,7 +135,7 @@ public class AnimatedValue : GLib.Object { public void update(double time) { this.state += time/this.duration; - if (state < 1) { + if (this.state < 1) { switch (this.type) { case Type.LINEAR: @@ -152,6 +158,7 @@ public class AnimatedValue : GLib.Object { } break; } + } else if (this.val != this.end) { this.val = this.end; } |