Re: Why using Tweener for animations?



On Thu, 2010-07-29 at 12:04 +0200, Giovanni Campagna wrote:

> > Also, Tweener is pretty convenient to use, and ClutterAnimator probably
> > wouldn't be quite as easy. Although that might be fixable with some JS
> > wrappers?
> 
> It turns out ClutterAnimation cannot be used in JS, due to the brokennes of Gjs.
> (clutter_actor_animatev throws before calling the C function,
> clutter_animation_bind returns null, ClutterInterval cannot be
> constructed because GTypes are not seen in JS code)

you can re-implement a JS module based on the Animation object itself;
that was the spirit of making the Animation class public and not just
expose clutter_actor_animate() (which is a C convenience API that does
automatic memory management).

the Animator class in Clutter 1.2 is even more complex than the
Animation class, and has the ability to be described in JSON instead of
coded by hand. it requires a bit of JS glue code to add multiple keys -
but, again, it's a pretty trivial endeavor.


> >> PS2: of course, if the answer is "kill Tweener", I'll be glad to help.
> >
> > It might be useful to see what some piece of existing code would look
> > like ported to ClutterAnimation.
> 
> In theory,
> Tweener.addTween(actor, duration, { property1: value1, property2: value2 });
> should be replaced by
> actor.animatev (mode, duration, ['property1', 'property2'], [value1, value2] );
> Unfortunately, that does not work because of binding problems.

you could write a Clutter.Actor.prototype.animate() override that
creates the Animation instance, keeps it around until the ::completed
signal has been fired, and parses the property/value pairs for you - and
calls clutter_animation_bind_property() behind the curtains.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, Open Source Software Engineer
Intel Open Source Technology Center



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]