[animation] Use ClutterAnimatable inside Animation
ClutterAnimation should check if the object is implementing the Animatable interface, and if so delegate to it the computation of the value along the interval initial and final value, depending on the progress.
This commit is contained in:
parent
24808e20b3
commit
60cfa5edb2
@ -50,6 +50,7 @@
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
#include "clutter-alpha.h"
|
||||
#include "clutter-animatable.h"
|
||||
#include "clutter-animation.h"
|
||||
#include "clutter-debug.h"
|
||||
#include "clutter-enum-types.h"
|
||||
@ -664,9 +665,17 @@ on_alpha_notify (GObject *gobject,
|
||||
ClutterAnimationPrivate *priv = animation->priv;
|
||||
GList *properties, *p;
|
||||
guint32 alpha_value;
|
||||
gboolean is_animatable = FALSE;
|
||||
ClutterAnimatable *animatable = NULL;
|
||||
|
||||
alpha_value = clutter_alpha_get_alpha (CLUTTER_ALPHA (gobject));
|
||||
|
||||
if (CLUTTER_IS_ANIMATABLE (priv->actor))
|
||||
{
|
||||
animatable = CLUTTER_ANIMATABLE (priv->actor);
|
||||
is_animatable = TRUE;
|
||||
}
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (priv->actor));
|
||||
|
||||
properties = g_hash_table_get_keys (priv->properties);
|
||||
@ -684,8 +693,29 @@ on_alpha_notify (GObject *gobject,
|
||||
|
||||
factor = (gdouble) alpha_value / CLUTTER_ALPHA_MAX_ALPHA;
|
||||
|
||||
if (clutter_interval_compute_value (interval, factor, &value))
|
||||
g_object_set_property (G_OBJECT (priv->actor), p_name, &value);
|
||||
if (is_animatable)
|
||||
{
|
||||
const GValue *initial, *final;
|
||||
|
||||
initial = clutter_interval_peek_initial_value (interval);
|
||||
final = clutter_interval_peek_final_value (interval);
|
||||
|
||||
CLUTTER_NOTE (ANIMATION, "Animatable property `%s'", p_name);
|
||||
clutter_animatable_animate_property (animatable, animation,
|
||||
p_name,
|
||||
initial, final,
|
||||
factor,
|
||||
&value);
|
||||
|
||||
g_object_set_property (G_OBJECT (priv->actor), p_name, &value);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLUTTER_NOTE (ANIMATION, "Standard property `%s'", p_name);
|
||||
|
||||
if (clutter_interval_compute_value (interval, factor, &value))
|
||||
g_object_set_property (G_OBJECT (priv->actor), p_name, &value);
|
||||
}
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user