scroll-view-fade: Tweak easing at edges

Since commit b4f5f1e461, 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
This commit is contained in:
Florian Müllner 2013-02-23 01:37:05 +01:00
parent 81e01b6f88
commit b394d184cc

View File

@ -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;