On Fri, 2007-12-14 at 12:20 +0100, Murray Cumming wrote:

> By the way, I don't really see the point of ClutterAlpha in the public
> API, unless you are planning to add more functions to it. At the moment
> it seems like behaviours could just take the alpha callback, and that
> alpha callback could receive the timeline as a parameter, instead of
> getting it from a ClutterAlpha.

no, we need to expose the ClutterAlpha API because the same ClutterAlpha
can be reused with multiple behaviours:

  timeline = clutter.Timeline(duration=1000)
  alpha = clutter.Alpha(timeline, clutter.ramp_inc_func)

  pathb = clutter.BehaviourPath(alpha, knots)
  depthb = clutter.BehaviourDepth(alpha, -100, 100)

  [b.apply(my_actor) for b in (pathb, depthb)]

will share the same alpha, hence the same timeline and the same function
of time.

this would become needlessly complicated if we passed the same function
and then the same timeline, for instance (fantasy code, it will not be
implemented):

  timeline = clutter.Timeline(duration=1000)

  pathb = clutter.BehaviourPath(timeline, clutter.ramp_inc_func, knots)
  depthb = clutter.BehaviourDepht(timeline, clutter.ramp_inc_func, -100,
100)

  [b.apply(my_actor) for b in (pathb, depthb)]

which will make the source one line shorter, but will add a function
argument to the behaviours and will require the following API additions:

  clutter_behaviour_get_timeline()
  clutter_behaviour_set_timeline()
  clutter_behaviour_set_alpha_function()

personally, I prefer keeping the behaviours blissfully unaware of what a
timeline is: the time+function aspect is covered by the alpha class,
which in turn can be used to drive other non-behaviour objects without
requiring additions or changes.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to