sprite_file: Wrap an image sprite for easy handling

View source: R/renderers.R

sprite_fileR Documentation

Wrap an image sprite for easy handling

Description

This function is equivalent to gif_file() but works for animations encoded as a sprite. A sprite is a single image file where each frame of the animation is stacked next to each other. The animation then happens by changing what slice of the image is shown. The implementation used allow users to click on the animation in order to toggle pause/play.

Usage

sprite_file(file, fps, width, full_width, height)

## S3 method for class 'sprite_image'
print(x, width = NULL, ...)

knit_print.sprite_image(x, options, ...)

Arguments

file

A png file with frames placed horizontally

fps

The framerate for the sprite animation

width, height

The dimension of a single frame

full_width

The width of the whole image

x

A sprite_image object

...

Arguments passed on

Value

sprite_file returns a sprite_image object which is a shallow wrapper around the file path text string along with dimensions and fps used for animating the sprite when printing.


gganimate documentation built on May 29, 2024, 2:58 a.m.