This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

1. Apocalypse 5

Back to Clutter/Apocalypses

1.1. Apocalypse

or Alpha Schm-alpha.

The Timeline should have a progress function to process the value returned when accessing the :progress property.

All API involving ClutterAlpha should be deprecated.

1.2. Exegesis

ClutterAlpha is a class that harks back to a different time, when ClutterTimelines were expensive, and where animations were controlled by behaviours that needed to be synchronized but required different easing modes.

Since the introduction of the new animation framework, both ClutterAlpha and ClutterTimeline are mostly used as internal types; Timeline is still exposed so that application code can control the animation without duplicating the same API in ClutterAnimation, ClutterAnimator, and ClutterState. ClutterAlpha, on the other hand, is a purely internal type, which is only manipulated through an easing mode enumeration property.

ClutterAlpha is also pretty inefficient: it requires calling a function during the ClutterTimeline::new-frame signal, or using an expensive notification of the :alpha property. The easing function also has to fetch the elapsed time and the duration from the timeline of the ClutterAlpha. this means many type checks and closures in a fairly performance critical path.

If we move the easing mode computation to ClutterTimeline we can achieve a more compact API, as well as a better performance profile; a timeline would pass the elapsed and total time to a progress function, and return the interpolated value, thus avoiding marshalling and asking the timeline through public API.

Sadly, we cannot deprecate ClutterAlpha:

We can, though, hint at its removal inside the documentation, and deprecating all public API that still uses ClutterAlpha.

Complete removal of ClutterAlpha is a 2.0 target.

1.3. Synopsis

1.3.1. ClutterTimeline progress mode

 void clutter_timeline_set_progress_mode (ClutterTimeline *timeline, ClutterAnimationMode mode);
 ClutterAnimationMode clutter_timeline_get_progress_mode (ClutterTimeline *timeline);

1.3.2. ClutterTimeline progress function

 /**
  * ClutterTimelineProgressFunc:
  * @timeline: a #ClutterTimeline
  * @elapsed: the time elapsed, in milliseconds
  * @duration: the duration of the timeline
  * @data: user data passed to the function
  *
  * Returns: a value in the closed interval [ -1, 2 ]
  */
 typedef double (* ClutterTimelineProgressFunc) (ClutterTimeline *timeline,
                                                 double           elapsed,
                                                 double           duration,
                                                 gpointer         user_data);

 void clutter_timeline_set_progress_func (ClutterTimeline             *timeline,
                                          ClutterTimelineProgressFunc  func,
                                          gpointer                     data,
                                          GDestroyNotify               notify);

2024-10-23 10:58