From b394d184cc7fa68924da7e4c57ba9d2eb84c97ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 23 Feb 2013 01:37:05 +0100 Subject: [PATCH] scroll-view-fade: Tweak easing at edges Since commit b4f5f1e46174, the effect is eased in at the scroll view's edges so that it does not appear out of nowhere. However, the linear easing used is not the best option, as now the effect appears so late that content near the edges ends up just being cut off rather than faded out. So adjust the easing function to have the effect appear faster. https://bugzilla.gnome.org/show_bug.cgi?id=694327 --- src/st/st-scroll-view-fade.glsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl index 6acd26000..e8bd03a2a 100644 --- a/src/st/st-scroll-view-fade.glsl +++ b/src/st/st-scroll-view-fade.glsl @@ -64,20 +64,20 @@ void main () float vfade_scale = height / vfade_offset; if (fade_top) { - ratio *= FADE((y / vfade_offset), min(vvalue * vfade_scale, 1.0)); + ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0)); } if (fade_bottom) { - ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min((1.0 - vvalue) * vfade_scale, 1.0)); + ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 - vvalue) * vfade_scale, 1.0)); } float hfade_scale = width / hfade_offset; if (fade_left) { - ratio *= FADE(x / hfade_offset, min(hvalue * hfade_scale, 1.0)); + ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0)); } if (fade_right) { - ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min((1.0 - hvalue) * hfade_scale, 1.0)); + ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue) * hfade_scale, 1.0)); } cogl_color_out *= ratio;