summaryrefslogtreecommitdiff
path: root/src/renderers/sliceRenderer.vala
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-03-05 12:19:59 +0100
committerAlessandro Ghedini <al3xbio@gmail.com>2012-03-05 12:19:59 +0100
commit98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (patch)
treeb98e438ac1082925e12af6dfec6d9ebeb4e3035e /src/renderers/sliceRenderer.vala
parenta824c3e5bdab686901b02667609282e7d596a6af (diff)
Imported Upstream version 0.5.1
Diffstat (limited to 'src/renderers/sliceRenderer.vala')
-rw-r--r--src/renderers/sliceRenderer.vala32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/renderers/sliceRenderer.vala b/src/renderers/sliceRenderer.vala
index 4803070..743f13e 100644
--- a/src/renderers/sliceRenderer.vala
+++ b/src/renderers/sliceRenderer.vala
@@ -86,6 +86,7 @@ public class SliceRenderer : GLib.Object {
private AnimatedValue alpha; // for fading in/out
private AnimatedValue fade_rotation; // for fading in/out
private AnimatedValue fade_scale; // for fading in/out
+ private AnimatedValue wobble; // for organic wobbling
/////////////////////////////////////////////////////////////////////
/// C'tor, initializes all AnimatedValues.
@@ -94,9 +95,10 @@ public class SliceRenderer : GLib.Object {
public SliceRenderer(PieRenderer parent) {
this.parent = parent;
- this.fade = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time);
- this.alpha = new AnimatedValue.linear(0.0, 1.0, Config.global.theme.fade_in_time);
- this.scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
+ this.fade = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time);
+ this.wobble = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time);
+ this.alpha = new AnimatedValue.linear(0.0, 1.0, Config.global.theme.fade_in_time);
+ this.scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
1.0/Config.global.theme.max_zoom,
1.0/Config.global.theme.max_zoom,
Config.global.theme.transition_time,
@@ -127,8 +129,8 @@ public class SliceRenderer : GLib.Object {
Config.global.theme.caption_color,
Config.global.global_scale);
- this.active_icon = new ThemedIcon(action.icon, true);
- this.inactive_icon = new ThemedIcon(action.icon, false);
+ this.active_icon = new ThemedIcon(action.name, action.icon, true);
+ this.inactive_icon = new ThemedIcon(action.name, action.icon, false);
this.color = new Color.from_icon(this.active_icon);
@@ -195,20 +197,36 @@ public class SliceRenderer : GLib.Object {
this.fade.update(frame_time);
this.fade_scale.update(frame_time);
this.fade_rotation.update(frame_time);
+ this.wobble.update(frame_time);
double direction = 2.0 * PI * position/parent.slice_count() + this.fade_rotation.val;
double max_scale = 1.0/Config.global.theme.max_zoom;
double diff = fabs(angle-direction);
-
+
if (diff > PI)
diff = 2 * PI - diff;
+
+ active = ((parent.active_slice >= 0) && (diff < PI/parent.slice_count()));
+
+ if (parent.active_slice >= 0) {
+ double wobble = Config.global.theme.wobble*diff/PI*(1-diff/PI);
+ if ((direction < angle && direction > angle - PI) || direction > PI+angle) {
+ this.wobble.reset_target(-wobble, Config.global.theme.transition_time*0.5);
+ } else {
+ this.wobble.reset_target(wobble, Config.global.theme.transition_time*0.5);
+ }
+ } else {
+ this.wobble.reset_target(0, Config.global.theme.transition_time*0.5);
+ }
+
+ direction += this.wobble.val;
if (diff < 2 * PI * Config.global.theme.zoom_range)
max_scale = (Config.global.theme.max_zoom/(diff * (Config.global.theme.max_zoom - 1)
/(2 * PI * Config.global.theme.zoom_range) + 1))
/Config.global.theme.max_zoom;
- active = ((parent.active_slice >= 0) && (diff < PI/parent.slice_count()));
+
max_scale = (parent.active_slice >= 0 ? max_scale : 1.0/Config.global.theme.max_zoom);