Re: libseed-list Clutter.Animator.set_key - g_value_set_float: assertion `G_VALUE_HOLDS_FLOAT (value)' failed
- From: "Alan Knowles" <alan akbkhome com>
- To: "tomw" <libseed-list-bounces gnome org>
- Cc: libseed-list gnome org
- Subject: Re: libseed-list Clutter.Animator.set_key - g_value_set_float: assertion `G_VALUE_HOLDS_FLOAT (value)' failed
- Date: Fri, 10 Dec 2010 16:24:33 +0800
Try this..
var start_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
var end_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
start_value.set_float(200);
end_value.set_float( 300);
in your version, the start_value was set to a Javascript number, which gets converted to a DOUBLE type
otherwise you could do:
animator.set_key(rec, "x", 2, a, [ imports.gi.GObject.TYPE_FLOAT, start_value]);
animator.set_key(rec, "x", 2, b, [ imports.gi.GObject.TYPE_FLOAT, end_value] );
Regards
Alan
--- On 10/Dec/2010, tomw wrote:
> Hi,
>
> trying to pass the variable to a Clutter.Animator.set_key method I'm
> getting the following error messages:
>
> (seed:2219): GLib-GObject-CRITICAL **: g_value_set_float: assertion
> `G_VALUE_HOLDS_FLOAT (value)' failed
>
> (seed:2219): Clutter-CRITICAL **: clutter_interval_set_initial_value:
> assertion `G_VALUE_TYPE (value) == priv->value_type' failed
>
> from my limited knowledge it seems that the values are not properly
> passed to the method
>
> Any idea how to fix this?
>
> br, tomw
>
>
>
> the code is as follows:
>
> #!/usr/bin/env seed
>
> const Clutter = imports.gi.Clutter;
> const GObject = imports.gi.GObject;
>
> Clutter.init(Seed.argv);
>
>
> var stage = Clutter.Stage.get_default ();
>
> stage.set_size(640, 480);
>
> var rec = new Clutter.Rectangle();
> var col = new Clutter.Color();
> col.from_string("light blue");
> rec.set_color(col);
> rec.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
> rec.set_size(100,100);
>
>
> var start_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
> var end_value = new GObject.Value(imports.gi.GObject.TYPE_FLOAT);
>
> start_value = 200;
> end_value = 300;
> a = 0.5;
> b = 0.8;
>
> var animator = new Clutter.Animator();
> var tl = new Clutter.Timeline({duration: 10000});
>
> animator.set_timeline(tl);
> animator.set_duration(3000);
> animator.set_key(rec, "x", 2, a, start_value);
> animator.set_key(rec, "x", 2, b, end_value);
>
>
> stage.add_actor(rec);
> stage.show();
> animator.start();
>
> Clutter.main();
>
> stage.destroy();
>
>
>
> _______________________________________________
> libseed-list mailing list
> libseed-list gnome org
> http://mail.gnome.org/mailman/listinfo/libseed-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]