2007-05-14 09:11:23 +00:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
* Jorn Baayen <jorn@openedhand.com>
|
|
|
|
* Emmanuele Bassi <ebassi@openedhand.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 OpenedHand
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2007-06-25 13:44:32 +00:00
|
|
|
* SECTION:clutter-effect
|
|
|
|
* @short_description: Utility Class for basic visual effects
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
2007-07-01 10:29:34 +00:00
|
|
|
* The #ClutterEffectTemplate class provides a simple API for applying
|
|
|
|
* pre-defined effects to a single actor. It works as a wrapper around
|
2008-01-30 12:13:26 +00:00
|
|
|
* the #ClutterBehaviour objects
|
2007-07-01 10:29:34 +00:00
|
|
|
*
|
|
|
|
* Since: 0.4
|
2007-05-14 09:11:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "clutter-alpha.h"
|
|
|
|
#include "clutter-main.h"
|
|
|
|
#include "clutter-marshal.h"
|
|
|
|
#include "clutter-private.h"
|
|
|
|
#include "clutter-debug.h"
|
|
|
|
#include "clutter-behaviour-bspline.h"
|
2007-08-15 19:50:16 +00:00
|
|
|
#include "clutter-behaviour-depth.h"
|
2007-05-14 09:11:23 +00:00
|
|
|
#include "clutter-behaviour-ellipse.h"
|
|
|
|
#include "clutter-behaviour-opacity.h"
|
|
|
|
#include "clutter-behaviour-path.h"
|
|
|
|
#include "clutter-behaviour-rotate.h"
|
|
|
|
#include "clutter-behaviour-scale.h"
|
|
|
|
|
|
|
|
#include "clutter-effect.h"
|
|
|
|
|
|
|
|
typedef struct ClutterEffectClosure
|
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
|
|
|
ClutterTimeline *timeline;
|
|
|
|
ClutterAlpha *alpha;
|
|
|
|
ClutterBehaviour *behave;
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
gulong signal_id;
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
ClutterEffectCompleteFunc completed_func;
|
|
|
|
gpointer completed_data;
|
|
|
|
ClutterEffectTemplate *template;
|
|
|
|
}
|
|
|
|
ClutterEffectClosure;
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (ClutterEffectTemplate, clutter_effect_template, G_TYPE_OBJECT);
|
|
|
|
|
|
|
|
#define EFFECT_TEMPLATE_PRIVATE(o) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), \
|
|
|
|
CLUTTER_TYPE_EFFECT_TEMPLATE, \
|
|
|
|
ClutterEffectTemplatePrivate))
|
|
|
|
|
|
|
|
struct _ClutterEffectTemplatePrivate
|
|
|
|
{
|
|
|
|
ClutterTimeline *timeline;
|
2007-11-28 10:27:33 +00:00
|
|
|
|
|
|
|
guint do_clone : 1;
|
|
|
|
guint dirty : 1;
|
2007-07-24 16:18:52 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
ClutterAlphaFunc alpha_func;
|
2007-07-24 16:18:52 +00:00
|
|
|
gpointer alpha_data;
|
|
|
|
GDestroyNotify alpha_notify;
|
2007-05-14 09:11:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2007-07-01 10:29:34 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
PROP_TIMELINE,
|
2007-08-24 15:12:52 +00:00
|
|
|
PROP_DO_CLONE
|
2007-05-14 09:11:23 +00:00
|
|
|
};
|
|
|
|
|
2007-07-24 16:18:52 +00:00
|
|
|
static void
|
|
|
|
clutter_effect_template_finalize (GObject *gobject)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplate *template = CLUTTER_EFFECT_TEMPLATE (gobject);
|
|
|
|
ClutterEffectTemplatePrivate *priv = template->priv;
|
|
|
|
|
|
|
|
if (priv->alpha_notify)
|
|
|
|
{
|
|
|
|
priv->alpha_notify (priv->alpha_data);
|
|
|
|
priv->alpha_notify = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->alpha_data = NULL;
|
|
|
|
priv->alpha_func = NULL;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (clutter_effect_template_parent_class)->finalize (gobject);
|
|
|
|
}
|
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
static void
|
|
|
|
clutter_effect_template_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplate *template;
|
|
|
|
ClutterEffectTemplatePrivate *priv;
|
|
|
|
|
2007-07-01 10:29:34 +00:00
|
|
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
|
|
|
priv = template->priv;
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2007-07-24 16:18:52 +00:00
|
|
|
if (priv->timeline)
|
|
|
|
{
|
|
|
|
g_object_unref (priv->timeline);
|
|
|
|
priv->timeline = NULL;
|
|
|
|
}
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2007-07-01 10:29:34 +00:00
|
|
|
G_OBJECT_CLASS (clutter_effect_template_parent_class)->dispose (object);
|
2007-05-14 09:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-30 12:13:26 +00:00
|
|
|
clutter_effect_template_set_property (GObject *object,
|
2007-05-14 09:11:23 +00:00
|
|
|
guint prop_id,
|
2008-01-30 12:13:26 +00:00
|
|
|
const GValue *value,
|
2007-05-14 09:11:23 +00:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplate *template;
|
|
|
|
ClutterEffectTemplatePrivate *priv;
|
|
|
|
|
2007-07-01 10:29:34 +00:00
|
|
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
2008-01-30 12:13:26 +00:00
|
|
|
priv = template->priv;
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2008-01-30 12:13:26 +00:00
|
|
|
switch (prop_id)
|
2007-05-14 09:11:23 +00:00
|
|
|
{
|
|
|
|
case PROP_TIMELINE:
|
2007-11-28 10:27:33 +00:00
|
|
|
priv->timeline = g_value_dup_object (value);
|
2007-08-29 22:32:47 +00:00
|
|
|
break;
|
2007-08-24 15:12:52 +00:00
|
|
|
case PROP_DO_CLONE:
|
2008-01-30 12:13:26 +00:00
|
|
|
clutter_effect_template_set_timeline_clone (template,
|
2007-08-24 15:12:52 +00:00
|
|
|
g_value_get_boolean (value));
|
2007-05-14 09:11:23 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-01-30 12:13:26 +00:00
|
|
|
clutter_effect_template_get_property (GObject *object,
|
2007-05-14 09:11:23 +00:00
|
|
|
guint prop_id,
|
2008-01-30 12:13:26 +00:00
|
|
|
GValue *value,
|
2007-05-14 09:11:23 +00:00
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplate *template;
|
|
|
|
ClutterEffectTemplatePrivate *priv;
|
|
|
|
|
2007-07-01 10:29:34 +00:00
|
|
|
template = CLUTTER_EFFECT_TEMPLATE (object);
|
|
|
|
priv = template->priv;
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2008-01-30 12:13:26 +00:00
|
|
|
switch (prop_id)
|
2007-05-14 09:11:23 +00:00
|
|
|
{
|
|
|
|
case PROP_TIMELINE:
|
|
|
|
g_value_set_object (value, priv->timeline);
|
|
|
|
break;
|
2007-08-24 15:12:52 +00:00
|
|
|
case PROP_DO_CLONE:
|
|
|
|
g_value_set_boolean (value, priv->do_clone);
|
|
|
|
break;
|
2007-05-14 09:11:23 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2008-01-30 12:13:26 +00:00
|
|
|
}
|
2007-05-14 09:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (ClutterEffectTemplatePrivate));
|
|
|
|
|
2007-07-24 16:18:52 +00:00
|
|
|
object_class->finalize = clutter_effect_template_finalize;
|
2007-05-14 09:11:23 +00:00
|
|
|
object_class->dispose = clutter_effect_template_dispose;
|
|
|
|
object_class->set_property = clutter_effect_template_set_property;
|
|
|
|
object_class->get_property = clutter_effect_template_get_property;
|
|
|
|
|
2007-07-04 14:00:41 +00:00
|
|
|
/**
|
|
|
|
* ClutterEffectTemplate:timeline:
|
|
|
|
*
|
|
|
|
* #ClutterTimeline to be used by the template
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2008-01-30 12:13:26 +00:00
|
|
|
g_object_class_install_property
|
2007-05-14 09:11:23 +00:00
|
|
|
(object_class,
|
|
|
|
PROP_TIMELINE,
|
|
|
|
g_param_spec_object ("timeline",
|
|
|
|
"Timeline",
|
|
|
|
"Timeline to use as a reference for the Template",
|
|
|
|
CLUTTER_TYPE_TIMELINE,
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
2007-08-24 15:12:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ClutterEffectTemplate:clone:
|
|
|
|
*
|
|
|
|
* Controls if effects should clone or reference the templated timeline
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
2008-01-30 12:13:26 +00:00
|
|
|
g_object_class_install_property
|
2007-08-24 15:12:52 +00:00
|
|
|
(object_class,
|
|
|
|
PROP_DO_CLONE,
|
|
|
|
g_param_spec_boolean ("clone",
|
|
|
|
"Clone",
|
|
|
|
"controls if effects should clone or reference the templated timeline",
|
|
|
|
TRUE,
|
|
|
|
CLUTTER_PARAM_READWRITE));
|
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_effect_template_init (ClutterEffectTemplate *self)
|
|
|
|
{
|
2007-07-01 10:29:34 +00:00
|
|
|
self->priv = EFFECT_TEMPLATE_PRIVATE (self);
|
2007-11-28 10:27:33 +00:00
|
|
|
|
2007-08-24 15:12:52 +00:00
|
|
|
self->priv->do_clone = TRUE;
|
2007-11-28 10:27:33 +00:00
|
|
|
self->priv->dirty = TRUE;
|
2007-05-14 09:11:23 +00:00
|
|
|
}
|
|
|
|
|
2007-07-24 16:18:52 +00:00
|
|
|
static void
|
|
|
|
clutter_effect_template_set_alpha_func (ClutterEffectTemplate *self,
|
|
|
|
ClutterAlphaFunc alpha_func,
|
|
|
|
gpointer alpha_data,
|
|
|
|
GDestroyNotify alpha_notify)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplatePrivate *priv;
|
|
|
|
|
|
|
|
priv = self->priv;
|
|
|
|
|
|
|
|
if (priv->alpha_notify)
|
|
|
|
{
|
|
|
|
priv->alpha_notify (priv->alpha_data);
|
|
|
|
priv->alpha_notify = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->alpha_data = alpha_data;
|
|
|
|
priv->alpha_notify = alpha_notify;
|
|
|
|
priv->alpha_func = alpha_func;
|
2007-11-28 10:27:33 +00:00
|
|
|
|
|
|
|
priv->dirty = FALSE;
|
2007-07-24 16:18:52 +00:00
|
|
|
}
|
|
|
|
|
2007-08-24 15:12:52 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_template_set_timeline_clone:
|
|
|
|
* @template_: A #ClutterEffectTemplate
|
|
|
|
* @setting: A boolean indicating if effects should clone the timeline.
|
|
|
|
*
|
2008-01-30 12:13:26 +00:00
|
|
|
* Sets if effects using this template should make a copy of the
|
2007-08-24 15:12:52 +00:00
|
|
|
* templates timeline (default) or reference the effects timeline.
|
2008-01-30 12:13:26 +00:00
|
|
|
*
|
2007-08-24 15:12:52 +00:00
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_effect_template_set_timeline_clone (ClutterEffectTemplate *template_,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
2007-10-10 16:02:54 +00:00
|
|
|
g_return_if_fail (CLUTTER_IS_EFFECT_TEMPLATE (template_));
|
|
|
|
|
|
|
|
if (template_->priv->do_clone != setting)
|
|
|
|
{
|
|
|
|
template_->priv->do_clone = setting;
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (template_), "clone");
|
|
|
|
}
|
2007-08-24 15:12:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_effect_template_get_timeline_clone:
|
2007-10-10 16:02:54 +00:00
|
|
|
* @template_: A #ClutterEffectTemplate
|
2007-08-24 15:12:52 +00:00
|
|
|
*
|
2007-10-10 16:02:54 +00:00
|
|
|
* Gets whether timelines should be cloned when creating a new
|
|
|
|
* effect or just referenced.
|
2007-08-24 15:12:52 +00:00
|
|
|
*
|
2007-10-10 16:02:54 +00:00
|
|
|
* Return value: %TRUE if the templates timeline is to be cloned.
|
2007-08-24 15:12:52 +00:00
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
clutter_effect_template_get_timeline_clone (ClutterEffectTemplate *template_)
|
|
|
|
{
|
2007-10-10 16:02:54 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_EFFECT_TEMPLATE (template_), FALSE);
|
|
|
|
|
2007-08-24 15:12:52 +00:00
|
|
|
return template_->priv->do_clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_template_new:
|
2007-06-25 13:44:32 +00:00
|
|
|
* @timeline: A #ClutterTimeline for the template (will be cloned)
|
|
|
|
* @alpha_func: An alpha func to use for the template.
|
|
|
|
*
|
2007-07-24 16:18:52 +00:00
|
|
|
* Creates a new #ClutterEffectTemplate, to be used with the effects API.
|
|
|
|
*
|
|
|
|
* A #ClutterEffectTemplate binds a timeline and an alpha function and can
|
|
|
|
* be used as a template for multiple calls of clutter_effect_fade(),
|
|
|
|
* clutter_effect_move() and clutter_effect_scale().
|
|
|
|
*
|
|
|
|
* This API is intended for simple animations involving a single actor;
|
|
|
|
* for more complex animations, you should see #ClutterBehaviour and the
|
|
|
|
* derived classes.
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
|
|
|
* Return value: a #ClutterEffectTemplate
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
2007-08-24 15:12:52 +00:00
|
|
|
ClutterEffectTemplate*
|
2008-01-30 12:13:26 +00:00
|
|
|
clutter_effect_template_new (ClutterTimeline *timeline,
|
2007-05-14 09:11:23 +00:00
|
|
|
ClutterAlphaFunc alpha_func)
|
|
|
|
{
|
2007-07-24 16:18:52 +00:00
|
|
|
ClutterEffectTemplate *retval;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
|
|
|
g_return_val_if_fail (alpha_func != NULL, NULL);
|
|
|
|
|
2008-01-30 12:13:26 +00:00
|
|
|
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
2007-07-24 16:18:52 +00:00
|
|
|
"timeline", timeline,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
clutter_effect_template_set_alpha_func (retval, alpha_func, NULL, NULL);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_effect_template_new_full:
|
|
|
|
* @timeline: a #ClutterTimeline
|
|
|
|
* @alpha_func: an alpha function to use for the template
|
|
|
|
* @user_data: data to be passed to the alpha function, or %NULL
|
|
|
|
* @notify: function to be called when disposing the alpha function's use
|
|
|
|
* data, or %NULL
|
|
|
|
*
|
|
|
|
* Creates a new #ClutterEffectTemplate, to be used with the effects API.
|
|
|
|
*
|
|
|
|
* A #ClutterEffectTemplate binds a timeline and an alpha function and can
|
|
|
|
* be used as a template for multiple calls of clutter_effect_fade(),
|
|
|
|
* clutter_effect_move() and clutter_effect_scale().
|
|
|
|
*
|
|
|
|
* This API is intended for simple animations involving a single actor;
|
|
|
|
* for more complex animations, you should see #ClutterBehaviour and the
|
|
|
|
* derived classes.
|
|
|
|
*
|
|
|
|
* This function is intended for language bindings only: if @notify is
|
|
|
|
* not %NULL it will be called to dispose of @user_data.
|
|
|
|
*
|
|
|
|
* Return value: the newly created #ClutterEffectTemplate object
|
|
|
|
*
|
|
|
|
* Since: 0.4
|
|
|
|
*/
|
|
|
|
ClutterEffectTemplate *
|
|
|
|
clutter_effect_template_new_full (ClutterTimeline *timeline,
|
|
|
|
ClutterAlphaFunc alpha_func,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify notify)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplate *retval;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
|
|
|
g_return_val_if_fail (alpha_func != NULL, NULL);
|
|
|
|
|
|
|
|
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
|
|
|
"timeline", timeline,
|
|
|
|
NULL);
|
|
|
|
|
2007-11-28 10:27:33 +00:00
|
|
|
clutter_effect_template_set_alpha_func (retval,
|
|
|
|
alpha_func,
|
|
|
|
user_data, notify);
|
2007-07-24 16:18:52 +00:00
|
|
|
|
|
|
|
return retval;
|
2007-05-14 09:11:23 +00:00
|
|
|
}
|
|
|
|
|
2007-11-15 15:38:04 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_template_new_for_duration:
|
|
|
|
* @msecs: the duration of the effects, in milliseconds
|
|
|
|
* @alpha_func: an alpha function to use for the template
|
|
|
|
*
|
|
|
|
* Creates a new #ClutterEffectTemplate, to be used with the effects API.
|
|
|
|
*
|
|
|
|
* A #ClutterEffectTemplate binds a timeline and an alpha function and can
|
|
|
|
* be used as a template for multiple calls of clutter_effect_fade(),
|
|
|
|
* clutter_effect_move() and clutter_effect_scale().
|
|
|
|
*
|
|
|
|
* This API is intended for simple animations involving a single actor;
|
|
|
|
* for more complex animations, you should see #ClutterBehaviour and the
|
|
|
|
* derived classes.
|
|
|
|
*
|
|
|
|
* This function creates a #ClutterTimeline with a duration of @msecs
|
|
|
|
* milliseconds and transfers ownership of the timeline object to the
|
|
|
|
* returned #ClutterEffectTemplate.
|
|
|
|
*
|
|
|
|
* Return value: the newly created #ClutterEffectTemplate object
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
ClutterEffectTemplate *
|
|
|
|
clutter_effect_template_new_for_duration (guint msecs,
|
|
|
|
ClutterAlphaFunc alpha_func)
|
|
|
|
{
|
|
|
|
ClutterTimeline *timeline;
|
|
|
|
ClutterEffectTemplate *retval;
|
|
|
|
|
|
|
|
g_return_val_if_fail (msecs > 0, NULL);
|
|
|
|
g_return_val_if_fail (alpha_func != NULL, NULL);
|
|
|
|
|
|
|
|
timeline = clutter_timeline_new_for_duration (msecs);
|
|
|
|
retval = clutter_effect_template_new (timeline, alpha_func);
|
|
|
|
|
|
|
|
/* the effect template takes ownership of the timeline */
|
|
|
|
g_object_unref (timeline);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2007-11-28 10:27:33 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_template_construct:
|
|
|
|
* @template_: a #ClutterEffectTemplate
|
|
|
|
* @timeline: a #ClutterTimeline
|
|
|
|
* @alpha_func: an alpha function to use for the template
|
|
|
|
* @user_data: data to be passed to the alpha function, or %NULL
|
|
|
|
* @notify: function to be called when disposing the alpha function's use
|
|
|
|
* data, or %NULL
|
|
|
|
*
|
|
|
|
* Constructs a #ClutterEffectTemplate, to be used with the effects API.
|
|
|
|
*
|
|
|
|
* This function can only be called once after the creation of @template_
|
|
|
|
* and is only useful for language bindings.
|
|
|
|
*
|
|
|
|
* Since: 0.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_effect_template_construct (ClutterEffectTemplate *template_,
|
|
|
|
ClutterTimeline *timeline,
|
|
|
|
ClutterAlphaFunc alpha_func,
|
|
|
|
gpointer user_data,
|
|
|
|
GDestroyNotify notify)
|
|
|
|
{
|
|
|
|
ClutterEffectTemplatePrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_EFFECT_TEMPLATE (template_));
|
|
|
|
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
|
|
|
g_return_if_fail (alpha_func != NULL);
|
|
|
|
|
|
|
|
if (!template_->priv->dirty)
|
|
|
|
return;
|
|
|
|
|
|
|
|
priv = template_->priv;
|
|
|
|
|
|
|
|
if (priv->timeline)
|
|
|
|
g_object_unref (priv->timeline);
|
|
|
|
|
|
|
|
priv->timeline = g_object_ref (timeline);
|
|
|
|
clutter_effect_template_set_alpha_func (template_,
|
|
|
|
alpha_func,
|
|
|
|
user_data, notify);
|
|
|
|
}
|
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
static void
|
|
|
|
clutter_effect_closure_destroy (ClutterEffectClosure *c)
|
|
|
|
{
|
|
|
|
g_signal_handler_disconnect (c->timeline, c->signal_id);
|
|
|
|
clutter_behaviour_remove (c->behave, c->actor);
|
|
|
|
|
|
|
|
g_object_unref (c->actor);
|
|
|
|
g_object_unref (c->template);
|
|
|
|
g_object_unref (c->behave);
|
|
|
|
g_object_unref (c->timeline);
|
|
|
|
|
|
|
|
g_slice_free (ClutterEffectClosure, c);
|
|
|
|
}
|
|
|
|
|
2007-07-01 10:29:34 +00:00
|
|
|
static ClutterEffectClosure *
|
2007-05-14 09:11:23 +00:00
|
|
|
clutter_effect_closure_new (ClutterEffectTemplate *template,
|
2008-01-30 12:13:26 +00:00
|
|
|
ClutterActor *actor,
|
2007-05-14 09:11:23 +00:00
|
|
|
GCallback complete)
|
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
|
|
|
ClutterEffectTemplatePrivate *priv = EFFECT_TEMPLATE_PRIVATE(template);
|
|
|
|
|
|
|
|
c = g_slice_new0(ClutterEffectClosure);
|
|
|
|
|
|
|
|
g_object_ref (actor);
|
|
|
|
g_object_ref (template);
|
|
|
|
|
|
|
|
c->template = template;
|
|
|
|
c->actor = actor;
|
2007-08-24 15:12:52 +00:00
|
|
|
|
|
|
|
if (clutter_effect_template_get_timeline_clone (template))
|
|
|
|
c->timeline = clutter_timeline_clone (priv->timeline);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
c->timeline = priv->timeline;
|
|
|
|
g_object_ref (priv->timeline);
|
|
|
|
}
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
c->alpha = clutter_alpha_new_full (c->timeline,
|
|
|
|
priv->alpha_func,
|
2007-07-24 16:18:52 +00:00
|
|
|
priv->alpha_data,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
c->signal_id =
|
2007-08-19 17:06:54 +00:00
|
|
|
g_signal_connect (c->timeline, "completed", G_CALLBACK (complete), c);
|
2007-05-14 09:11:23 +00:00
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_effect_complete (ClutterTimeline *timeline,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
ClutterEffectClosure *c = (ClutterEffectClosure*)user_data;
|
|
|
|
|
|
|
|
if (c->completed_func)
|
2007-08-19 17:06:54 +00:00
|
|
|
c->completed_func (c->actor, c->completed_data);
|
2007-05-14 09:11:23 +00:00
|
|
|
|
|
|
|
clutter_effect_closure_destroy (c);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_effect_fade:
|
2007-07-04 14:00:41 +00:00
|
|
|
* @template_: A #ClutterEffectTemplate
|
2007-06-25 13:44:32 +00:00
|
|
|
* @actor: A #ClutterActor to apply the effect to.
|
2007-11-13 13:21:56 +00:00
|
|
|
* @opacity_end: Final opacity value to apply to actor
|
2007-11-23 11:23:19 +00:00
|
|
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
2007-07-04 14:00:41 +00:00
|
|
|
* completion or %NULL
|
2007-11-23 11:23:19 +00:00
|
|
|
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
2007-07-04 14:00:41 +00:00
|
|
|
* or %NULL
|
|
|
|
*
|
|
|
|
* Simple effect for fading a single #ClutterActor.
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
2007-06-25 13:44:32 +00:00
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unrefed by
|
|
|
|
* the effect when completed.
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-05-14 09:11:23 +00:00
|
|
|
*/
|
2007-07-04 14:00:41 +00:00
|
|
|
ClutterTimeline *
|
|
|
|
clutter_effect_fade (ClutterEffectTemplate *template_,
|
2007-07-01 10:29:34 +00:00
|
|
|
ClutterActor *actor,
|
2007-11-13 13:21:56 +00:00
|
|
|
guint8 opacity_end,
|
2007-11-23 11:23:19 +00:00
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-05-14 09:11:23 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
2007-11-23 11:23:19 +00:00
|
|
|
guint8 opacity_start;
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2007-07-04 14:00:41 +00:00
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-05-14 09:11:23 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
opacity_start = clutter_actor_get_opacity (actor);
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2008-01-30 12:13:26 +00:00
|
|
|
c->behave = clutter_behaviour_opacity_new (c->alpha,
|
|
|
|
opacity_start,
|
2007-11-13 13:21:56 +00:00
|
|
|
opacity_end);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|
|
|
|
|
2007-08-15 19:50:16 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_depth:
|
|
|
|
* @template_: A #ClutterEffectTemplate
|
|
|
|
* @actor: A #ClutterActor to apply the effect to.
|
2007-11-13 13:21:56 +00:00
|
|
|
* @depth_end: Final depth value to apply to actor
|
2007-11-23 11:23:19 +00:00
|
|
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
2007-08-15 19:50:16 +00:00
|
|
|
* completion or %NULL
|
2007-11-23 11:23:19 +00:00
|
|
|
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
2007-08-15 19:50:16 +00:00
|
|
|
* or %NULL
|
|
|
|
*
|
|
|
|
* Simple effect for changing the depth of a single #ClutterActor.
|
|
|
|
*
|
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unrefed by
|
|
|
|
* the effect when completed.
|
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-08-15 19:50:16 +00:00
|
|
|
*/
|
|
|
|
ClutterTimeline *
|
|
|
|
clutter_effect_depth (ClutterEffectTemplate *template_,
|
2007-11-23 11:23:19 +00:00
|
|
|
ClutterActor *actor,
|
|
|
|
gint depth_end,
|
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-08-15 19:50:16 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
2007-11-23 11:23:19 +00:00
|
|
|
gint depth_start;
|
2007-08-15 19:50:16 +00:00
|
|
|
|
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-08-15 19:50:16 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
|
|
|
|
|
|
|
depth_start = clutter_actor_get_depth (actor);
|
2007-08-15 19:50:16 +00:00
|
|
|
|
2007-11-13 13:21:56 +00:00
|
|
|
c->behave = clutter_behaviour_depth_new (c->alpha, depth_start, depth_end);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-08-15 19:50:16 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-08-15 19:50:16 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|
|
|
|
|
2007-05-14 09:11:23 +00:00
|
|
|
/**
|
|
|
|
* clutter_effect_move:
|
2007-07-04 14:00:41 +00:00
|
|
|
* @template_: A #ClutterEffectTemplate
|
2007-06-25 13:44:32 +00:00
|
|
|
* @actor: A #ClutterActor to apply the effect to.
|
2007-11-23 11:23:19 +00:00
|
|
|
* @x: X coordinate of the destination
|
|
|
|
* @y: Y coordinate of the destination
|
|
|
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
2007-07-04 14:00:41 +00:00
|
|
|
* completion or %NULL
|
2007-11-23 11:23:19 +00:00
|
|
|
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
2007-07-04 14:00:41 +00:00
|
|
|
* or %NULL
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Simple effect for moving a single #ClutterActor along to a
|
|
|
|
* destination point.
|
2007-07-04 14:00:41 +00:00
|
|
|
*
|
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unreferenced by
|
|
|
|
* the effect when completed.
|
2007-05-14 09:11:23 +00:00
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-05-14 09:11:23 +00:00
|
|
|
*/
|
2007-07-04 14:00:41 +00:00
|
|
|
ClutterTimeline *
|
|
|
|
clutter_effect_move (ClutterEffectTemplate *template_,
|
2007-07-01 10:29:34 +00:00
|
|
|
ClutterActor *actor,
|
2007-11-23 11:23:19 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-05-14 09:11:23 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
2007-11-23 11:23:19 +00:00
|
|
|
ClutterKnot knots[2];
|
2007-05-14 09:11:23 +00:00
|
|
|
|
2007-07-04 14:00:41 +00:00
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-05-14 09:11:23 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
2007-05-30 23:16:58 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
knots[0].x = clutter_actor_get_x (actor);
|
|
|
|
knots[0].y = clutter_actor_get_y (actor);
|
2007-05-30 23:16:58 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
knots[1].x = x;
|
|
|
|
knots[1].y = y;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->behave = clutter_behaviour_path_new (c->alpha, knots, 2);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-30 23:16:58 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-05-30 23:16:58 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|
2007-07-25 12:17:44 +00:00
|
|
|
/**
|
2007-11-23 11:23:19 +00:00
|
|
|
* clutter_effect_path:
|
2007-07-25 12:17:44 +00:00
|
|
|
* @template_: A #ClutterEffectTemplate
|
|
|
|
* @actor: A #ClutterActor to apply the effect to.
|
2007-11-23 11:23:19 +00:00
|
|
|
* @knots: An array of #ClutterKnots representing path for the actor
|
|
|
|
* @n_knots: Number of #ClutterKnots in passed array.
|
|
|
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
|
|
|
* completion or %NULL
|
|
|
|
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
|
|
|
* or %NULL
|
2007-07-25 12:17:44 +00:00
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Simple effect for moving a single #ClutterActor along a path.
|
2007-07-25 12:17:44 +00:00
|
|
|
*
|
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unreferenced by
|
|
|
|
* the effect when completed.
|
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-07-25 12:17:44 +00:00
|
|
|
*/
|
|
|
|
ClutterTimeline *
|
2007-11-23 11:23:19 +00:00
|
|
|
clutter_effect_path (ClutterEffectTemplate *template_,
|
|
|
|
ClutterActor *actor,
|
|
|
|
const ClutterKnot *knots,
|
|
|
|
guint n_knots,
|
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-07-25 12:17:44 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
|
|
|
|
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-07-25 12:17:44 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
if (n_knots)
|
|
|
|
clutter_actor_set_position (actor, knots[0].x, knots[0].y);
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->behave = clutter_behaviour_path_new (c->alpha, knots, n_knots);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-23 11:23:19 +00:00
|
|
|
* clutter_effect_scale:
|
2007-07-25 12:17:44 +00:00
|
|
|
* @template_: A #ClutterEffectTemplate
|
|
|
|
* @actor: A #ClutterActor to apply the effect to.
|
2008-01-17 14:31:14 +00:00
|
|
|
* @x_scale_end: Final X axis scale factor to apply to actor
|
|
|
|
* @y_scale_end: Final Y axis scale factor to apply to actor
|
2007-11-23 11:23:19 +00:00
|
|
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
2007-07-25 12:17:44 +00:00
|
|
|
* completion or NULL
|
2007-11-23 11:23:19 +00:00
|
|
|
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
2007-07-25 12:17:44 +00:00
|
|
|
* or NULL
|
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Simple effect for scaling a single #ClutterActor.
|
2007-07-25 12:17:44 +00:00
|
|
|
*
|
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unreferenced by
|
|
|
|
* the effect when completed.
|
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-07-25 12:17:44 +00:00
|
|
|
*/
|
|
|
|
ClutterTimeline *
|
2007-11-23 11:23:19 +00:00
|
|
|
clutter_effect_scale (ClutterEffectTemplate *template_,
|
|
|
|
ClutterActor *actor,
|
2008-01-17 14:31:14 +00:00
|
|
|
gdouble x_scale_end,
|
|
|
|
gdouble y_scale_end,
|
2007-11-23 11:23:19 +00:00
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-07-25 12:17:44 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
2008-01-17 14:31:14 +00:00
|
|
|
gdouble x_scale_start, y_scale_start;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-07-25 12:17:44 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2008-01-17 14:31:14 +00:00
|
|
|
clutter_actor_get_scale (actor, &x_scale_start, &y_scale_start);
|
2008-01-30 12:13:26 +00:00
|
|
|
c->behave = clutter_behaviour_scale_new (c->alpha,
|
2008-01-17 14:31:14 +00:00
|
|
|
x_scale_start, y_scale_start,
|
2008-01-30 12:13:26 +00:00
|
|
|
x_scale_end, y_scale_end);
|
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2007-11-23 11:23:19 +00:00
|
|
|
* clutter_effect_rotate:
|
|
|
|
* @template_: a #ClutterEffectTemplate
|
|
|
|
* @actor: a #ClutterActor to apply the effect to.
|
|
|
|
* @axis: axis of rotation
|
|
|
|
* @angle: final angle to apply to actor
|
2007-11-23 13:11:10 +00:00
|
|
|
* @center_x: position on X axis to rotate about.
|
2007-11-23 11:23:19 +00:00
|
|
|
* @center_y: position on Y axis to rotate about.
|
|
|
|
* @center_z: position on Z axis to rotate about.
|
|
|
|
* @direction: a #ClutterRotateDirection for the rotation.
|
|
|
|
* @func: a #ClutterEffectCompleteFunc to call on effect
|
|
|
|
* completion or %NULL
|
|
|
|
* @data: user data to pass to supplied @func or %NULL
|
2007-07-25 12:17:44 +00:00
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Simple effect for rotating a single #ClutterActor.
|
2007-07-25 12:17:44 +00:00
|
|
|
*
|
|
|
|
* Return value: a #ClutterTimeline for the effect. Will be unreferenced by
|
|
|
|
* the effect when completed.
|
|
|
|
*
|
2007-11-23 11:23:19 +00:00
|
|
|
* Since: 0.6
|
2007-07-25 12:17:44 +00:00
|
|
|
*/
|
|
|
|
ClutterTimeline *
|
2007-11-23 11:23:19 +00:00
|
|
|
clutter_effect_rotate (ClutterEffectTemplate *template_,
|
|
|
|
ClutterActor *actor,
|
|
|
|
ClutterRotateAxis axis,
|
|
|
|
gdouble angle_end,
|
|
|
|
gint center_x,
|
|
|
|
gint center_y,
|
|
|
|
gint center_z,
|
|
|
|
ClutterRotateDirection direction,
|
|
|
|
ClutterEffectCompleteFunc func,
|
|
|
|
gpointer data)
|
2007-07-25 12:17:44 +00:00
|
|
|
{
|
|
|
|
ClutterEffectClosure *c;
|
2007-11-23 11:23:19 +00:00
|
|
|
gdouble angle_start;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
|
|
|
c = clutter_effect_closure_new (template_,
|
2008-01-30 12:13:26 +00:00
|
|
|
actor,
|
2007-07-25 12:17:44 +00:00
|
|
|
G_CALLBACK (on_effect_complete));
|
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
c->completed_func = func;
|
|
|
|
c->completed_data = data;
|
2007-07-25 12:17:44 +00:00
|
|
|
|
2007-11-23 11:23:19 +00:00
|
|
|
angle_start = clutter_actor_get_rotation (actor, axis, NULL, NULL, NULL);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
c->behave = clutter_behaviour_rotate_new (c->alpha,
|
2008-01-12 11:05:05 +00:00
|
|
|
axis,
|
2007-07-25 12:17:44 +00:00
|
|
|
direction,
|
2007-11-13 13:21:56 +00:00
|
|
|
angle_start,
|
2007-07-25 12:17:44 +00:00
|
|
|
angle_end);
|
|
|
|
g_object_set (c->behave,
|
2007-11-23 11:23:19 +00:00
|
|
|
"center-x", center_x,
|
2007-07-25 12:17:44 +00:00
|
|
|
"center-y", center_y,
|
2007-11-23 11:23:19 +00:00
|
|
|
"center-z", center_z,
|
2007-07-25 12:17:44 +00:00
|
|
|
NULL);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
clutter_behaviour_apply (c->behave, actor);
|
|
|
|
clutter_timeline_start (c->timeline);
|
2008-01-30 12:13:26 +00:00
|
|
|
|
2007-07-25 12:17:44 +00:00
|
|
|
return c->timeline;
|
|
|
|
}
|