diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:20:00 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:20:00 +0100 |
commit | 9efffcc071e59e6c0fe5d0b406e558cc7319e8ee (patch) | |
tree | 1f4d8d555dc439403da78c52e413be3c29833c21 /src/renderers/sliceRenderer.vala | |
parent | 75655ffca55cb5e5ca51d8f6a4d3d600f1f54cdc (diff) | |
parent | 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (diff) |
Merge tag 'upstream/0.5.1'
Upstream version 0.5.1
Diffstat (limited to 'src/renderers/sliceRenderer.vala')
-rw-r--r-- | src/renderers/sliceRenderer.vala | 32 |
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); |