~ubuntu-branches/ubuntu/saucy/clutter-perl/saucy

« back to all changes in this revision

Viewing changes to examples/behaviour.pl

  • Committer: Bazaar Package Importer
  • Author(s): Ross Burton
  • Date: 2008-07-22 09:19:03 UTC
  • mfrom: (1.2.1 upstream) (5 hardy)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20080722091903-wrxww7pfc2d438e3
* New upstream release.
* Bump Clutter depends to 0.8 and add missing depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
    return unless scalar @actors;
89
89
 
90
90
    foreach my $actor (@actors) {
91
 
        $actor->rotate_z($angle, $actor->get_x() - 100, $actor->get_y() - 100);
 
91
        $actor->set_rotation('z-axis', $angle,
 
92
                             $actor->get_x() - 20,
 
93
                             $actor->get_y() - 20,
 
94
                             0);
92
95
    }
93
96
}
94
97
 
98
101
use warnings;
99
102
 
100
103
use Glib qw( :constants );
101
 
use Gtk2;
102
104
use Clutter qw( :init );
103
105
 
104
106
my $stage = Clutter::Stage->get_default();
119
121
$group->add($rect);
120
122
$rect->show();
121
123
 
122
 
my $pixbuf;
123
 
eval { $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file('redhand.png'); };
 
124
my $hand;
 
125
eval { $hand = Clutter::Texture->new('redhand.png') };
124
126
if ($@) {
125
127
    warn ("Unable to load 'redhand.png': $@");
126
128
}
127
129
else {
128
 
    my $hand = Clutter::Texture->new($pixbuf);
129
130
    $hand->set_position(5, 5);
130
131
 
131
 
    $rect->set_size($pixbuf->get_width()  + 5,
132
 
                    $pixbuf->get_height() + 5);
 
132
    $rect->set_size($hand->get_width()  + 5,
 
133
                    $hand->get_height() + 5);
133
134
 
134
135
    $group->add($hand);
135
136
    $hand->show();
138
139
my $timeline = Clutter::Timeline->new(100, 26);
139
140
$timeline->set(loop => TRUE);
140
141
 
141
 
my $alpha = Clutter::Alpha->new($timeline, \&Clutter::Alpha::sine);
 
142
my $alpha = Clutter::Alpha->new($timeline, sub {
 
143
    my $alpha = shift;
 
144
    my $timeline = $alpha->get_timeline();
 
145
 
 
146
    return int($timeline->get_progress() * Clutter::Alpha->MAX_ALPHA);
 
147
});
 
148
 
142
149
my $o_behave = Clutter::Behaviour::Opacity->new($alpha, 0x33, 0xff);
143
150
$o_behave->apply($group);
144
151