diff --git a/clutter/clutter-animation.c b/clutter/clutter-animation.c index dd01dee76..0a9c448f4 100644 --- a/clutter/clutter-animation.c +++ b/clutter/clutter-animation.c @@ -765,6 +765,59 @@ clutter_animation_update_interval (ClutterAnimation *animation, clutter_animation_update_property_internal (animation, pspec, interval); } +/** + * clutter_animation_update: + * @animation: a #ClutterAnimation + * @property_name: name of the property + * @final: The final value of the property + * + * Updates the @final value of the interval for @property_name + * + * Return value: (transfer none): The animation itself. + * + * Since: 1.0 + */ +ClutterAnimation * +clutter_animation_update (ClutterAnimation *animation, + const gchar *property_name, + const GValue *final) +{ + ClutterAnimationPrivate *priv; + ClutterInterval *interval; + + g_return_val_if_fail (CLUTTER_IS_ANIMATION (animation), NULL); + g_return_val_if_fail (property_name != NULL, NULL); + g_return_val_if_fail (final != NULL, NULL); + g_return_val_if_fail (G_VALUE_TYPE (final) != G_TYPE_INVALID, NULL); + + priv = animation->priv; + + interval = clutter_animation_get_interval (animation, property_name); + if (interval == NULL) + { + g_warning ("Cannot update property '%s': the animation has " + "no bound property with that name", + property_name); + return NULL; + } + + if (!g_value_type_compatible (G_VALUE_TYPE (final), + clutter_interval_get_value_type (interval))) + { + g_warning ("Cannot update property '%s': the interval value of " + "type '%s' is not compatible with the property value " + "of type '%s'", + property_name, + g_type_name (clutter_interval_get_value_type (interval)), + g_type_name (G_VALUE_TYPE (final))); + return NULL; + } + + clutter_interval_set_final_value (interval, final); + + return animation; +} + /** * clutter_animation_get_interval: * @animation: a #ClutterAnimation diff --git a/clutter/clutter-animation.h b/clutter/clutter-animation.h index d8cf74d8c..3eb90cde4 100644 --- a/clutter/clutter-animation.h +++ b/clutter/clutter-animation.h @@ -126,6 +126,9 @@ ClutterAnimation * clutter_animation_bind_interval (ClutterAnimation *an ClutterInterval *interval); gboolean clutter_animation_has_property (ClutterAnimation *animation, const gchar *property_name); +ClutterAnimation * clutter_animation_update (ClutterAnimation *animation, + const gchar *property_name, + const GValue *final); void clutter_animation_update_interval (ClutterAnimation *animation, const gchar *property_name, ClutterInterval *interval); diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index a40eca6de..30fd665cf 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -1436,6 +1436,7 @@ clutter_animation_completed clutter_animation_bind clutter_animation_bind_interval +clutter_animation_update clutter_animation_update_interval clutter_animation_has_property clutter_animation_unbind_property