summaryrefslogtreecommitdiff
path: root/src/utilities/animatedValue.vala
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-01-21 19:07:09 +0100
committerAlessandro Ghedini <al3xbio@gmail.com>2012-01-21 19:07:09 +0100
commit60560a030fda3c539ff9dc1563b9926414a193da (patch)
tree77590b395685a8d48d3615e45629a1610d08c071 /src/utilities/animatedValue.vala
parentd6b2677825cbb423e2099563c16321c3e23d7899 (diff)
Imported Upstream version 0.4.0upstream/0.4.0
Diffstat (limited to 'src/utilities/animatedValue.vala')
-rw-r--r--src/utilities/animatedValue.vala13
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;
}