Documentation ¶
Overview ¶
Package animation provides animated image support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Animator ¶
type Animator interface { // Animate renders the frames into dst and calls // fn on each rendered frame. Animate(ctx context.Context, dst draw.Image, fn func(image.Image) error) error image.Image }
Animator is an image that can animate frames.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an ardilla.RawFrame cache.
type GIF ¶
type GIF struct { *gif.GIF // Cache caches GIF frames in the internal format // of the device. Cache must not be changed while // an animation is running. Cache *Cache // contains filtered or unexported fields }
GIF is an animated GIF.
The GIF image.Image implementation is conditional on whether an animation The image is either from the first or last frame; if an terminates the last frame is used, if it does not terminate the first is used. GIF animations that terminate should ensure that the final frame is a complete renderable image.
GIF pointer values must not be shared between goroutines. It is safe to share the backing gif.GIF and Cache values, so if a GIF is to be used concurrently, each goroutine should have a pointer to a copy of a parent concrete GIF value.
func (*GIF) Animate ¶
Animate renders the receiver's frames into dst and calls fn on each rendered frame.
func (*GIF) ColorModel ¶
ColorModel implements the image.Image interface. If the GIF has a global color table, its color model is returned, otherwise the first or last frame's model is used.
type GIFs ¶
type GIFs []*GIF
GIFs is an animator that runs through a set of GIF animations in order. Each of the GIFs must have the same bounds and only the last GIF in the sequence may be non-terminating. As with the GIF type, if the final GIF in the sequence has completed, it's final frame is used as the complete image.Image, otherwise the first frame of the first GIF in the sequence is used.
func (GIFs) Animate ¶
Animate renders the receiver's GIFs' frames into dst and calls fn on each rendered frame.
func (GIFs) ColorModel ¶
ColorModel implements the image.Image interface.
type Images ¶
type Images struct { // The successive images. Image []image.Image // Delay is the delay between images. Delay time.Duration // LoopCount controls the number of times an animation will be // restarted during display. // A LoopCount of 0 means to loop forever. // A LoopCount of -1 means to show each frame only once. // Otherwise, the animation is looped LoopCount+1 times. LoopCount int // Cache caches frames in the internal format // of the device. Cache must not be changed while // an animation is running. Cache *Cache // contains filtered or unexported fields }
Images is an animator that animates through a set of images in order similar to the GIFs type. If an image in the set is an Animator, it is animated. No checks are made for non-terminating animations with the set.
func (*Images) Animate ¶
Animate renders the receiver's images into dst and calls fn on each rendered image.
func (*Images) ColorModel ¶
ColorModel implements the image.Image interface.
type ReadPeeker ¶
ReadPeeker is an io.Reader that can also peek n bytes ahead.
func AsReadPeeker ¶
func AsReadPeeker(r io.Reader) ReadPeeker
AsReadPeeker converts an io.Reader to a ReadPeeker.
type Text ¶
type Text string
Text is a scrolling text animator.
func (Text) GIF ¶
GIF returns a GIF containing animation frames required to present the full length of the receiver within the given bounds using basicfont.Face7x13. The provided palette must have at least two colors, which will be indexed by fg and bg to provide the foreground and background colors for the text animation.