mirror of
https://github.com/brl/mutter.git
synced 2025-07-07 19:31:25 +00:00
2007-01-04 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.c: * clutter/clutter-actor.h: Add new set_width/height API calls. Tweak scaling by reseting matrix. Make set_opactiy() take parent opacity into account. Fix clipping. * clutter/clutter-alpha.c: Add more sine functionality. * clutter/clutter-behaviour-opacity.c: Dont make a copy of all applied actors but use a foreach() * clutter/clutter-behaviour-scale.c: Give correct limits to propertys. Tweak gravity a little more. Update docs. : * clutter/clutter-behaviour.c: (clutter_behaviour_remove): Minor warning text change. * clutter/clutter-feature.c: (clutter_feature_wait_for_vblank): Minor dri ioctl tweak. * clutter/clutter-label.c: * clutter/clutter-label.h: Add new label_full api call.
This commit is contained in:
@ -491,6 +491,30 @@ clutter_ramp_func (ClutterAlpha *alpha,
|
||||
}
|
||||
}
|
||||
|
||||
static guint32
|
||||
sinc_func (ClutterAlpha *alpha,
|
||||
float angle,
|
||||
float offset)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
gint current_frame_num, n_frames;
|
||||
gdouble x, sine;
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
|
||||
current_frame_num = clutter_timeline_get_current_frame (timeline);
|
||||
n_frames = clutter_timeline_get_n_frames (timeline);
|
||||
|
||||
/* FIXME: fixed point, and fixed point sine() */
|
||||
|
||||
x = (gdouble) (current_frame_num * angle * M_PI) / n_frames ;
|
||||
sine = (sin (x - (M_PI / angle)) + offset) * 0.5f;
|
||||
|
||||
CLUTTER_NOTE (ALPHA, "sine: %2f\n", sine);
|
||||
|
||||
return (guint32) (sine * (gdouble) CLUTTER_ALPHA_MAX_ALPHA);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_sine_func:
|
||||
* @alpha: a #ClutterAlpha
|
||||
@ -507,21 +531,24 @@ guint32
|
||||
clutter_sine_func (ClutterAlpha *alpha,
|
||||
gpointer dummy)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
gint current_frame_num, n_frames;
|
||||
gdouble x, sine;
|
||||
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
|
||||
current_frame_num = clutter_timeline_get_current_frame (timeline);
|
||||
n_frames = clutter_timeline_get_n_frames (timeline);
|
||||
|
||||
/* FIXME: fixed point, and fixed point sine() */
|
||||
|
||||
x = (gdouble) (current_frame_num * 2.0f * M_PI) / n_frames ;
|
||||
sine = (sin (x - (M_PI / 2.0f)) + 1.0f) * 0.5f;
|
||||
|
||||
CLUTTER_NOTE (ALPHA, "sine: %2f\n", sine);
|
||||
|
||||
return (guint32) (sine * (gdouble) CLUTTER_ALPHA_MAX_ALPHA);
|
||||
return sinc_func (alpha, 2.0, 1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_sine_inc_func:
|
||||
* @alpha: a #ClutterAlpha
|
||||
* @dummy: unused argument
|
||||
*
|
||||
* Convenience alpha function for a sine wave. You can use this
|
||||
* function as the alpha function for clutter_alpha_set_func().
|
||||
*
|
||||
* Return value: an alpha value.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
guint32
|
||||
clutter_sine_inc_func (ClutterAlpha *alpha,
|
||||
gpointer dummy)
|
||||
{
|
||||
return sinc_func (alpha, 0.5, 1.0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user