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