| 1 |
|
| 2 |
=head1 NAME |
| 3 |
|
| 4 |
Tk::Animation - Display sequence of Tk::Photo images |
| 5 |
|
| 6 |
=for pm Tk/Animation.pm |
| 7 |
|
| 8 |
=for category Tk Image Classes |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
use Tk::Animation |
| 13 |
my $img = $widget->Animation('-format' => 'gif', -file => 'somefile.gif'); |
| 14 |
|
| 15 |
$img->add_frame(@images); |
| 16 |
|
| 17 |
$img->start_animation; |
| 18 |
$img->start_animation( $period ); |
| 19 |
|
| 20 |
$img->next_image; |
| 21 |
$img->prev_image; |
| 22 |
$img->set_image( 0 .. $#frames ); |
| 23 |
|
| 24 |
$img->pause_animation; |
| 25 |
$img->resume_animation( $period ); |
| 26 |
|
| 27 |
$img->fast_forward( $multiplier ); |
| 28 |
$img->fast_reverse( $multiplier ); |
| 29 |
|
| 30 |
$img->stop_animation; |
| 31 |
|
| 32 |
$img->set_disposal_method( $boolean ); |
| 33 |
|
| 34 |
=head1 DESCRIPTION |
| 35 |
|
| 36 |
In the simple case when C<Animation> is passed a GIF89 style GIF with |
| 37 |
multiple 'frames', it will build an internal array of C<Photo> images. |
| 38 |
|
| 39 |
The C<add_frame> method adds images to the sequence. It is provided |
| 40 |
to allow animations to be constructed from separate images. |
| 41 |
All images must be C<Photo>s and should all be the same size. |
| 42 |
|
| 43 |
C<start_animation($period)> then initiates a C<repeat> with specified |
| 44 |
I<$period> to sequence through these images. As for raw C<repeat> |
| 45 |
I<$period> is in milliseconds, for a 50Hz monitor it should be at |
| 46 |
least 20ms. If I<$period> is omitted it is determined from the GIF |
| 47 |
metadata (see below), or if this is not possible it defaults to 100 |
| 48 |
milliseconds. |
| 49 |
|
| 50 |
C<stop_animation> cancels the C<repeat> and resets the image to the first |
| 51 |
image in the sequence. |
| 52 |
|
| 53 |
For fine-grained control C<next_image> and C<prev_image> move one frame forward |
| 54 |
or backward. C<set_image> randomly positions the animation to a particular frame. |
| 55 |
|
| 56 |
C<pause_animation> pauses the movie and C<resume_animation> continues from the |
| 57 |
pause point. |
| 58 |
|
| 59 |
C<fast_forward> and C<fast_reverse> speed through the movie either |
| 60 |
forwards or backwards. $multiplier specifies how much faster the |
| 61 |
animation moves. |
| 62 |
|
| 63 |
If L<Image::Info> is installed, then the repeat period time and |
| 64 |
disposal method of GIF animations are determined from the GIF metadata |
| 65 |
directly. Otherwise the disposal method must be set manually by using |
| 66 |
C<set_disposal_method> (1 for blanking the previous images, 0 for |
| 67 |
leaving the previous images as is). The repeat period time may be |
| 68 |
given in the C<start_animation> method. |
| 69 |
|
| 70 |
=head1 NOTES |
| 71 |
|
| 72 |
C<set_disposal_method> was formerly known as C<blank> method, but the |
| 73 |
naming of this method was a mistake. |
| 74 |
|
| 75 |
If the disposal method is not set correctly, either by |
| 76 |
C<set_disposal_method> or by determining from the GIF metadata, then |
| 77 |
the following may happen: By default Animation leaves the previous |
| 78 |
movie frame in the animation photo. Many times overlaying subsequent |
| 79 |
frames produces a composite that looks blurred. |
| 80 |
|
| 81 |
=head1 BUGS |
| 82 |
|
| 83 |
This module should not depend on a module which is not declared as a |
| 84 |
dependency (Image::Info). |
| 85 |
|
| 86 |
The delays between images may vary in a GIF animation. This cannot be |
| 87 |
handled by this module yet. |
| 88 |
|
| 89 |
The handling of the various disposal methods is not correct. |
| 90 |
|
| 91 |
=cut |
| 92 |
|