Animation class

Stores multiple images, most often as the frames of an animation.

Some formats, such as TiffDecoder, support multiple images that are not to be interpreted as animation, but rather multiple pages of a document. The Animation container is still used to store the images for these files. The frameType property is used to differentiate multi-page documents from multi-frame animations, where it is set to FrameType.page for documents and FrameType.animation for animated frames.

All Decoder classes support decoding to an Animation, where the Animation will only contain a single frame for single image formats such as JPEG, or if the file doesn't contain any animation such as a single image GIF. If you want to generically support both animated and non-animated files, you can always decode to an animation and if the animation has only a single frame, then it's a non-animated image.

In some cases, the frames of the animation may only provide a portion of the canvas, such as the case of animations encoding only the changing pixels from one frame to the next. The width and height and backgroundColor properties of the Animation provide information about the canvas that contains the animation, and the Image frames provide information about how to draw the particular frame, such as the area of the canvas to draw into, and if the canvas should be cleared prior to drawing the frame.

Inheritance

Constructors

Animation()

Properties

backgroundColor int
The suggested background color to clear the canvas with.
read / write
first Image
The first frame of the animation.
read-only, override
frames List<Image>
The frames of the animation.
read / write
frameType FrameType
How should the frames be interpreted? If FrameType.animation, the frames are part of an animated sequence. If FrameType.page, the frames are the pages of a document.
read / write
height int
The canvas height for containing the animation.
read / write
isEmpty bool
Is the animation empty (no frames)?
read-only, override
isNotEmpty bool
Returns true if there is at least one frame in the animation.
read-only, override
iterator Iterator<Image>
Get the iterator for looping over the animation. This allows the Animation to be used in for-each loops: for (AnimationFrame frame in animation) { ... }
read-only, override
last Image
The last frame of the animation.
read-only, override
length int
How many frames are in the animation?
read-only, override
loopCount int
How many times should the animation loop (0 means forever)?
read / write
numFrames int
How many frames are in the animation?
read-only
width int
The canvas width for containing the animation.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
single Image
Checks that this iterable has only one element, and returns that element. [...]
read-only, inherited

Methods

addFrame(Image image) → void
Add a frame to the animation.
any(bool test(Image element)) bool
Checks whether any element of this iterable satisfies test. [...]
inherited
cast<R>() Iterable<R>
Provides a view of this iterable as an iterable of R instances. [...]
inherited
contains(Object element) bool
Returns true if the collection contains an element equal to element. [...]
inherited
elementAt(int index) Image
Returns the indexth element. [...]
inherited
every(bool test(Image element)) bool
Checks whether every element of this iterable satisfies test. [...]
inherited
expand<T>(Iterable<T> f(Image element)) Iterable<T>
Expands each element of this Iterable into zero or more elements. [...]
inherited
firstWhere(bool test(Image element), {Image orElse()}) Image
Returns the first element that satisfies the given predicate test. [...]
inherited
fold<T>(T initialValue, T combine(T previousValue, Image element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value [...]
inherited
followedBy(Iterable<Image> other) Iterable<Image>
Returns the lazy concatentation of this iterable and other. [...]
inherited
forEach(void f(Image element)) → void
Applies the function f to each element of this collection in iteration order.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings. [...]
inherited
lastWhere(bool test(Image element), {Image orElse()}) Image
Returns the last element that satisfies the given predicate test. [...]
inherited
map<T>(T f(Image e)) Iterable<T>
Returns a new lazy Iterable with elements that are created by calling f on each element of this Iterable in iteration order. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
reduce(Image combine(Image value, Image element)) Image
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function. [...]
inherited
singleWhere(bool test(Image element), {Image orElse()}) Image
Returns the single element that satisfies test. [...]
inherited
skip(int count) Iterable<Image>
Returns an Iterable that provides all but the first count elements. [...]
inherited
skipWhile(bool test(Image value)) Iterable<Image>
Returns an Iterable that skips leading elements while test is satisfied. [...]
inherited
take(int count) Iterable<Image>
Returns a lazy iterable of the count first elements of this iterable. [...]
inherited
takeWhile(bool test(Image value)) Iterable<Image>
Returns a lazy iterable of the leading elements satisfying test. [...]
inherited
toList({bool growable: true}) List<Image>
Creates a List containing the elements of this Iterable. [...]
inherited
toSet() Set<Image>
Creates a Set containing the same elements as this iterable. [...]
inherited
toString() String
Returns a string representation of (some of) the elements of this. [...]
inherited
where(bool test(Image element)) Iterable<Image>
Returns a new lazy Iterable with all elements that satisfy the predicate test. [...]
inherited
whereType<T>() Iterable<T>
Returns a new lazy Iterable with all elements that have type T. [...]
inherited

Operators

operator [](int index) Image
Get the frame at the given index.
operator ==(dynamic other) bool
The equality operator. [...]
inherited