Prima::...:Animate(3)
π Prima::Image::Animate π
Bestie, welcome to the Prima::...:Animate(3) page from User Contributed Perl Documentation. The actual module is Prima::Image::Animate, and we're about to make animation make sense. No cap. π«Ά
πΈ NAME πΈ
Prima::Image::Animate β animate gif,webp,png files
π DESCRIPTION π
The module provides high-level access to GIF, APNG, and WebP animation sequences. It's giving "animation access, but make it high-level." π
β¨ SYNOPSIS β¨
Here's the whole demo, copied with love and zero changes:
use Prima qw(Application Image::Animate);
my $x = Prima::Image::Animate->load($ARGV[0]);
die $@ unless $x;
my ( $X, $Y) = ( 0, 100);
my $want_background = 1; # 0 for eventual transparency
my $background = $::application-> get_image( $X, $Y, $x-> size);
$::application-> begin_paint;
while ( my $info = $x-> next) {
my $frame = $background-> dup;
$frame-> begin_paint;
$x-> draw_background( $frame, 0, 0) if $want_background;
$x-> draw( $frame, 0, 0);
$::application-> put_image( $X, $Y, $frame);
$::application-> sync;
select(undef, undef, undef, $info-> {delay});
}
$::application-> put_image( $X, $Y, $g);
Okay, method roll call time. Every signature stays exactly as written β no renaming, no merging, no crumbs. π
new $CLASS, %OPTIONS
Creates an empty animation container. If $OPTIONS{images} is given, it is expected to be an array of images, best if loaded from files with the loadExtras and iconUnmask parameters set (see Prima::image-load for details). Container girlie is born. β¨
detect_animation $HASH
Checks the {extras} hash obtained from an image loaded with the loadExtras flag set to detect whether the image is an animation or not, and whether the module supports loading all of its frames. Returns the file format name on success, undef otherwise. Detective mode: activated. π
load $SOURCE, %OPTIONS
Loads a GIF, APNG, or WebP animation sequence from $SOURCE, which is either a file or a stream. Options are the same as used by the Prima::Image::load method.
Depending on the loadAll option, either loads all frames at once (1), or uses Prima::Image::Loader to load only a single frame at a time (0, default). Depending on the loading mode, some properties may not be available. Mode check matters, bestie. π
add $IMAGE
Appends an image frame to the container.
π¨ Only available if the loadAll option is on.
bgColor
Returns the background color specified by the sequence as the preferred color to use when there is no specific background to superimpose the animation on. Background-color realness. π¨
close
Releases eventual image file handle for loader-based animations. Sets the {suspended} flag so that all image operations are suspended. A later call to reload restores the status quo except the current frame prior to the close call.
π Has no effect on animations loaded with the loadAll option.
current
Returns the index of the current frame. Where are we? Right here. π
draw $CANVAS, $X, $Y
Draws the current composite frame on $CANVAS at the given coordinates. Put it there, iconically. ποΈ
draw_background $CANVAS, $X, $Y
Fills the background on $CANVAS at the given coordinates if the file provides the color to fill. Returns a boolean value whether the canvas was drawn on or not. Background check: complete. β
height
Returns the height of the composite frame.
icon
Returns a new icon object created from the current composite frame. Tiny icon era. π
image
Returns a new image object created from the current composite frame. The transparent pixels on the image are replaced with the preferred background color. Transparency, but make it backed. π¦
is_stopped
Returns true if the animation sequence was stopped, false otherwise. If the sequence was stopped, the only way to restart it is to call reset. Stopped means stopped, bestie. β
length
Returns the total animation length (without repeats) in seconds. Time math, but cute. β³
loopCount [ INTEGER ]
Sets and returns the number of loops left, undef for indefinite. Loop-de-loop realness. π
next
Advances one animation frame. The step triggers changes to the internally kept buffer image that creates the effect of transparency if needed. The method returns a hash, where the following fields are initialized:
left,bottom,right,topβ coordinates of the changed area since the last frame was updateddelayβ time in seconds how long the frame is expected to be displayed
Next frame, next vibe. π¦
reload
Reloads the animation after a close call. Returns the success flag. Comeback era. π
reset
Resets the animation sequence. This call is necessary either when the image sequence was altered, or when the sequence display restart is needed. Press reset, start fresh. β¨
size
Returns the width and height of the composite frame.
suspended
Returns true if a call to the close method was made. Suspended in animation jail. π
total
Returns the number of frames. Count them, bestie. π’
warning
If an error occurred during frame loading, it will be stored in the warning property. The animation will stop at the last successfully loaded frame.
π¨ Only available if the loadAll option is off.
width
Returns the width of the composite frame.
π SEE ALSO π
Prima::image-loadPrima::Image::Loader
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org>.
That's the whole page, bestie. It's from perl v5.42.0, dated 2024-08-20, and its manual name is Prima::...:Animate(3) β now go make something move. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms