Commit 81538d49 authored by Jasper St. Pierre's avatar Jasper St. Pierre

revealer: Use the same transition animation as GtkStack

parent ee8b3efb
......@@ -506,11 +506,14 @@ gtk_revealer_set_position (GtkRevealer *revealer,
g_object_notify (G_OBJECT (revealer), "child-revealed");
}
static gdouble
ease_out_quad (gdouble t, gdouble d)
/* From clutter-easing.c, based on Robert Penner's
* infamous easing equations, MIT license.
*/
static double
ease_out_cubic (double t)
{
gdouble p = t / d;
return ((-1.0) * p) * (p - 2);
double p = t - 1;
return p * p * p + 1;
}
static void
......@@ -520,10 +523,11 @@ gtk_revealer_animate_step (GtkRevealer *revealer,
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
gdouble t;
t = 1.0;
if (now < priv->end_time)
t = (now - priv->start_time) / (gdouble) (priv->end_time - priv->start_time);
t = ease_out_quad (t, 1.0);
t = (now - priv->start_time) / (gdouble) (priv->end_time - priv->start_time);
else
t = 1.0;
t = ease_out_cubic (t);
gtk_revealer_set_position (revealer,
priv->source_pos + (t * (priv->target_pos - priv->source_pos)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment