[cairo] Re: Goocanvas:
absolute-position animation and "update" confusion
Damon Chaplin
damon at karuna.uklinux.net
Wed Dec 6 05:50:15 PST 2006
On Tue, 2006-12-05 at 08:13 -0800, Carl Worth wrote:
> On Tue, 05 Dec 2006 07:35:18 -0800, Carl Worth wrote:
> > Maybe all that I'm missing is a goo_canvas_item_set_position or so,
> > (something like canvas_item_translate but with an absolute position
> > instead of an offset).
>
> Another reason I would want this is if I do ever want to implement
> something fancy like "animate along a path" then I'll need
> "set_position" primitive I can build on to implement that. It would
> not be pleasant at all if I had to totally re-vamp the way my object
> works, (eg. using private x,y values and using those in "paint" rather
> than doing a zero-based paint and trusting the matrix to do the
> positioning), just to extend the way I animate for example.
>
> That is, it would be nice if a single model could be used by both
> simple applications and applications with more complex needs. That way
> there's a smooth way for applications to "grow up".
>
> To me it seems like something like "set_position" would do this just
> fine, (but I'm still not sure if I have a grasp of the intended model
> yet).
If you just want to move items around, you can just change the position
properties with something like:
g_object_set (object, "x", 100.0, "y", 100.0, NULL).
Though if you want to rotate/scale/skew the item as well you need to
position the item appropriately (e.g. centered on the origin for
rotation), and use the transform for moving/animation.
The standard items support both methods, and leave it up to higher-level
code to decide which one it needs to use.
Damon
More information about the cairo
mailing list