AnimationKit.FrameSet

Holds a set of AnimationKit.Frame objects used to animate with a AnimationKit.FrameTask.

This class supports multiple usage syntaxes. Developers can choose to use this as a class, like they would a FolderItem, or they can choose to use it as an array. Each of the following syntaxes are acceptable:

For I As Integer = 0 To Set.Count - 1
Dim Frame As AnimationKit.Frame = Set.Frame(I)
// Do something
Next

For I As Integer = 0 To UBound(Set)
Dim Frame As AnimationKit.Frame = Set(I)
// Do something
Next

For Each Frame As AnimationKit.Frame In Set
// Do something
Next

Frame Dimensions

All frames in a set must match their dimensions exactly. Only when the set is empty will the set accept an image of any size. Once the set has one or more frames, attempting to add a frame with different dimensions will trigger an UnsupportedOperationException.

Methods

Sub Append (Frame As AnimationKit.Frame)

Add a frame to the end the set.

Function Count () As Integer

Returns the number of items in the set.

Function FirstFrame () As AnimationKit.Frame

This is a shorthand for Frame(0).

Function Frame (Index As Integer) As AnimationKit.Frame

Returns the frame at the given 0-based index.

Sub Frame (Index As Integer, Assigns Value As AnimationKit.Frame)

Changes the frame at the give 0-based index.

Function IndexOf (Frame As AnimationKit.Frame) As Integer

Returns the index of the given frame, or -1 if not found.

Sub Insert (Index As Integer, Frame As AnimationKit.Frame)

Adds a new frame at the given index, increasing the index of each frame whose index is >= the given index.

Function LastFrame () As AnimationKit.Frame

This is a shorthand for Frame(Count - 1).

Sub Remove (Index As Integer)

Removes the frame at the given index.

Function Reverse () As AnimationKit.FrameSet

Returns a new frame set with the frames in reverse.

Shared Methods

Shared Function CreateFromSpriteSheet (Sprites As iOSImage, RetinaSprites As iOSImage, CellWidth As Integer, CellHeight As Integer, Rows As Integer, Columns As Integer) As AnimationKit.FrameSet
Shared Function CreateFromSpriteSheet (Sprites As Picture, RetinaSprites As Picture, CellWidth As Integer, CellHeight As Integer, Rows As Integer, Columns As Integer) As AnimationKit.FrameSet

These methods take a sprite grid and create a frame set. Provide the size of each cell, as well as the number of rows and columns in the grid. The input graphic will be checked to ensure dimensions match the provided cell sizes, row count, and column count. The Retina graphic is very strongly recommended, but not required. To avoid supporting retina resolutions properly, pass Nil for the second parameter.

See Also

AnimationKit.Frame, AnimationKit.FrameTarget, AnimationKit.FrameTask