diff --git a/compositor/compositor.c b/compositor/compositor.c index 6288337e..5df67d10 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -116,6 +116,7 @@ wlsc_tweener_init(struct wlsc_tweener *tweener, double k, double current, double target) { tweener->k = k; + tweener->friction = 100.0; tweener->current = current; tweener->previous = current; tweener->target = target; @@ -124,22 +125,28 @@ wlsc_tweener_init(struct wlsc_tweener *tweener, WL_EXPORT void wlsc_tweener_update(struct wlsc_tweener *tweener, uint32_t msec) { - double force, current, step; + double force, v, current, step; - step = (msec - tweener->timestamp) / 100.0; + step = (msec - tweener->timestamp) / 500.0; tweener->timestamp = msec; current = tweener->current; + v = current - tweener->previous; force = tweener->k * (tweener->target - current) / 10.0 + - (tweener->previous - current); + (tweener->previous - current) - v * tweener->friction; tweener->current = current + (current - tweener->previous) + force * step * step; tweener->previous = current; if (tweener->current >= 1.0) { +#ifdef TWEENER_BOUNCE + tweener->current = 2.0 - tweener->current; + tweener->previous = 2.0 - tweener->previous; +#else tweener->current = 1.0; tweener->previous = 1.0; +#endif } if (tweener->current <= 0.0) { diff --git a/compositor/compositor.h b/compositor/compositor.h index 2db98a12..48e2ebe8 100644 --- a/compositor/compositor.h +++ b/compositor/compositor.h @@ -106,6 +106,7 @@ struct wlsc_animation { struct wlsc_tweener { double k; + double friction; double current; double target; double previous; diff --git a/compositor/meego-tablet-shell.c b/compositor/meego-tablet-shell.c index 44480b2d..6dbb0b9b 100644 --- a/compositor/meego-tablet-shell.c +++ b/compositor/meego-tablet-shell.c @@ -525,6 +525,6 @@ shell_init(struct wlsc_compositor *compositor) launch_switcher(shell); - wlsc_tweener_init(&compositor->fade.tweener, 0.8, 1.0, 1.0); + wlsc_tweener_init(&compositor->fade.tweener, 40.0, 1.0, 1.0); shell->starting = 1; }