--- timer.pl
+++ timer.pl
@@ -12,10 +12,10 @@
my $stage = Clutter::Stage->get_default();
$stage->set_size(600, 400);
-$stage->set_color(Clutter::Color->parse('#224444ff'));
+$stage->set_color(Clutter::Color->from_string('#224444ff'));
my $pie_slice = Clutter::Ex::PieSlice->new();
-$pie_slice->set_color(Clutter::Color->parse('#ff7700ff'));
+$pie_slice->set_color(Clutter::Color->from_string('#ff7700ff'));
$pie_slice->set_reactive(TRUE);
$pie_slice->set_size(300, 300);
$pie_slice->set_anchor_point(150, 150);
@@ -23,10 +23,12 @@
$stage->add($pie_slice);
$pie_slice->signal_connect(clicked => sub { Clutter->main_quit() });
-my $timeline1 = Clutter::Timeline->new(120, 12);
+my $duration = 10000;
+my $timeline1 = Clutter::Timeline->new($duration);
$timeline1->set(loop => TRUE);
$timeline1->signal_connect('new-frame', sub {
- $pie_slice->set_proportion($_[1] * 100 / 120);
+ my($timeline, $elapsed) = @_;
+ $pie_slice->set_proportion($elapsed * 100 / $duration);
});
$stage->show_all();
Index: Clutter/Ex/PieSlice.pm
===================================================================
--- Clutter/Ex/PieSlice.pm
+++ Clutter/Ex/PieSlice.pm
@@ -95,12 +95,17 @@
my $angle = $self->{proportion} * 360 / 100;
my $radius = $geom->width() / 2;
- Clutter::Cogl->path_move_to($radius, $radius);
- Clutter::Cogl->path_arc($radius, $radius, $radius, $radius, -90, $angle - 90);
- Clutter::Cogl->path_close();
-
- Clutter::Cogl->color($pick_color);
- Clutter::Cogl->path_fill();
+ Clutter::Cogl::Path->move_to($radius, $radius);
+ Clutter::Cogl::Path->arc($radius, $radius, $radius, $radius, -90, $angle - 90);
+ Clutter::Cogl::Path->close();
+
+ Clutter::Cogl->set_source_color([
+ $pick_color->red(),
+ $pick_color->green(),
+ $pick_color->blue(),
+ $pick_color->alpha(),
+ ]);
+ Clutter::Cogl::Path->fill();
}
sub PAINT {
@@ -110,16 +115,21 @@
my $angle = $self->{proportion} * 360 / 100;
my $radius = $geom->width() / 2;
- Clutter::Cogl->path_move_to($radius, $radius);
- Clutter::Cogl->path_arc($radius, $radius, $radius, $radius, -90, $angle - 90);
- Clutter::Cogl->path_close();
+ Clutter::Cogl::Path->move_to($radius, $radius);
+ Clutter::Cogl::Path->arc($radius, $radius, $radius, $radius, -90, $angle - 90);
+ Clutter::Cogl::Path->close();
my $color = $self->{color};
$color->alpha(255);
- Clutter::Cogl->color($color);
- Clutter::Cogl->path_fill();
+ Clutter::Cogl->set_source_color([
+ $color->red(),
+ $color->green(),
+ $color->blue(),
+ $color->alpha(),
+ ]);
+ Clutter::Cogl::Path->fill();
}
sub SET_PROPERTY {