Gorgon
Show / Hide Table of Contents

Class GorgonAnimationBuilder

A builder used to create IGorgonAnimation objects.

Inheritance
object
GorgonAnimationBuilder
Implements
IGorgonFluentBuilder<GorgonAnimationBuilder, IGorgonAnimation>
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Animation
Assembly: Gorgon.Animation.dll
Syntax
public class GorgonAnimationBuilder : IGorgonFluentBuilder<GorgonAnimationBuilder, IGorgonAnimation>
Remarks

This builder is used to create and configure an animation with key frames for the various animation tracks.

Animations are composed of multiple tracks which represent the properties on the objects that are to be animated. Within these tracks, there are multiple key frames which indicate the value of the property at a specified time (measured in seconds). When the animation plays, the values in these key frames are interpolated between each frame to give the appearance of a smooth transition between the values.

When building an animation using this builder type the tracks are edited via one of the several Edit methods on the builder. Each edit method corresponds to the type of data for the track (e.g. Vector2, float, etc...) and takes the registration TrackName of the track to indicate which track (and object property) is being edited.

Methods

| Edit this page View Source

Build(string, float, float?)

Function to return the newly built animation.

Declaration
public IGorgonAnimation Build(string name, float fps = 60, float? length = null)
Parameters
Type Name Description
string name

The name of the animation.

float fps

[Optional] The frames per second for the animation.

float? length

[Optional] The length of the animation, in seconds.

Returns
Type Description
IGorgonAnimation

The object created or updated by this builder.

Remarks

When the fps parameter is omitted, it will default to 60 frames per second. This parameter is used to adjust the key frame times to fit within the specified frame delays for the frames per second. If this value is less than 1, the animation will be assumed to be 1 frame per second.

When the length parameter is omitted, the length of the animation will be calculated based on the key frame times present in the tracks. This may not be ideal for certain cases, so supplying this value will force the animation length to be as long as the user requires. If 0, or less is supplied to this parameter the length will be reset to exactly 1 frame of animation (one frame = 1 / fps).

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

Clear()

Function to clear the builder to a default state.

Declaration
public GorgonAnimationBuilder Clear()
Returns
Type Description
GorgonAnimationBuilder

The fluent builder interface.

See Also
GorgonTrackRegistration
| Edit this page View Source

Delete2DTexture(string)

Function to delete a track that updates a GorgonTexture2DView, texture coordinates, and/or texture array indices for its key frame values.

Declaration
public GorgonAnimationBuilder Delete2DTexture(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteColor(string)

Function to delete a track that updates a GorgonColor value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteColor(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteQuaternion(string)

Function to delete a track that updates a Quaternion value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteQuaternion(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteRectangle(string)

Function to delete a track that updates a SharpDX RectangleF value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteRectangle(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteSingle(string)

Function to delete a track that updates a single floating point value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteSingle(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteVector2(string)

Function to delete a track that updates a 2D vector value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteVector2(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteVector3(string)

Function to delete a track that updates a 3D vector value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteVector3(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

DeleteVector4(string)

Function to delete a track that updates a 4D vector value for its key frame values.

Declaration
public GorgonAnimationBuilder DeleteVector4(string name)
Parameters
Type Name Description
string name

The registration name of the track to delete.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder for the animation.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

KeyNotFoundException

Thrown if the track with the name specified does not exist.

See Also
GorgonTrackRegistration
| Edit this page View Source

Edit2DTexture(string)

Function to edit a track that updates a GorgonTexture2DView, texture coordinates, and/or texture array indices for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyTexture2D> Edit2DTexture(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyTexture2D>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditColor(string)

Function to edit a track that uses GorgonColor values for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyGorgonColor> EditColor(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyGorgonColor>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditQuaternion(string)

Function to edit a track that uses quaternions for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyQuaternion> EditQuaternion(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyQuaternion>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditRectangle(string)

Function to edit a track that uses SharpDX RectangleF values for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyRectangle> EditRectangle(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyRectangle>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditSingle(string)

Function to edit a track that uses single floating point values for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeySingle> EditSingle(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeySingle>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditVector2(string)

Function to edit a track that uses 2D vectors for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyVector2> EditVector2(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyVector2>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditVector3(string)

Function to edit a track that uses 3D vectors for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyVector3> EditVector3(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyVector3>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

EditVector4(string)

Function to edit a track that uses 4D vectors for its key frame values.

Declaration
public IGorgonTrackKeyBuilder<GorgonKeyVector4> EditVector4(string name)
Parameters
Type Name Description
string name

The registration name of the track to edit.

Returns
Type Description
IGorgonTrackKeyBuilder<GorgonKeyVector4>

The builder used to update the requested animation track.

Remarks

If no track exists with the specified name, then a new track is created.

Exceptions
Type Condition
ArgumentNullException

Thrown when the name parameter is null.

ArgumentEmptyException

Thrown when the name parameter is empty.

See Also
GorgonTrackRegistration
| Edit this page View Source

ResetTo(IGorgonAnimation)

Function to reset the builder to the specified object state.

Declaration
public GorgonAnimationBuilder ResetTo(IGorgonAnimation builderObject = null)
Parameters
Type Name Description
IGorgonAnimation builderObject

[Optional] The specified object state to copy.

Returns
Type Description
GorgonAnimationBuilder

The fluent builder interface.

Remarks

Passing null to the builderObject parameter will clear the builder settings.

See Also
GorgonTrackRegistration

Implements

IGorgonFluentBuilder<TB, TBo>

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

GorgonTrackRegistration
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author