Skip to content

cf_make_png_cache_animation

Category: png_cache
GitHub: cute_png_cache.h


Constructs an animation out of an array of frames, along with their delays in milliseconds, or returns one from the cache if it already exists.

const CF_Animation* cf_make_png_cache_animation(const char* name, const CF_Png* pngs, int pngs_count, const float* delays, int delays_count);
Parameters Description
name A unique name for the animation.
pngs An array of pngs, see CF_Png.
pngs_count The number of images in the pngs array.
delays A delay in milliseconds for each frame of the animation.
delays_count The number of floats in the delays array. This must match pngs_count.

Return Value

Returns a CF_Animation, representing a single animation sequence.

Remarks

Since png files do not contain any kind of animation information (frame delays or sets of frames) you must specify all of the animation data yourself in order to make sprites. To flip between different animations you can construct an animation table with cf_make_png_cache_animation_table, which returns a table of unique animation names to individual CF_Animation's.

CF_Png
cf_png_cache_load
cf_make_png_cache_sprite
cf_make_png_cache_animation_table