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.
getter/setter pair
first Image
The first frame of the animation.
no setteroverride
frames List<Image>
The frames of the animation.
getter/setter pair
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.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height int
The canvas height for containing the animation.
getter/setter pair
isEmpty bool
Is the animation empty (no frames)?
no setteroverride
isNotEmpty bool
Returns true if there is at least one frame in the animation.
no setteroverride
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) { ... }
no setteroverride
last Image
The last frame of the animation.
no setteroverride
length int
How many frames are in the animation?
no setteroverride
loopCount int
How many times should the animation loop (0 means forever)?
getter/setter pair
numFrames int
How many frames are in the animation?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single Image
Checks that this iterable has only one element, and returns that element.
no setterinherited
width int
The canvas width for containing the animation.
getter/setter pair

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>
A view of this iterable as an iterable of R instances.
inherited
contains(Object? element) bool
Whether 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> toElements(Image element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(Image element), {Image orElse()?}) Image
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>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(Image element)) → void
Invokes action on each element of this iterable 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
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(Image e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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
The single element that satisfies test.
inherited
skip(int count) Iterable<Image>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(Image value)) Iterable<Image>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<Image>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(Image value)) Iterable<Image>
Creates 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>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

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