Table of Contents

Class Animation

Namespace
Fantas
Assembly
Fantas.dll

Animation class (Move, Scale, Rotate, Fade...)

public sealed class Animation
Inheritance
Animation
Inherited Members

Properties

Duration

Duration to complete the animation. WARNING: Some animation might ignore the change to this value after the animation is created

public TimeSpan Duration { get; set; }

Property Value

TimeSpan

DurationSeconds

Duration to complete the animation. WARNING: Some animation might ignore the change to this value after the animation is created

public double DurationSeconds { get; set; }

Property Value

double

ReversedAnimation

Create a reversed animation WARNING: Fade, and Texture animation won't have reverse You have to manually create FadeIn/FadeOut reverses

public Animation ReversedAnimation { get; }

Property Value

Animation

Speed

Speed of animation

public float Speed { get; set; }

Property Value

float

TimingFunction

Delegate used to customize the timing

public AnimationTimingFunction TimingFunction { get; set; }

Property Value

AnimationTimingFunction

TimingMode

Animation timing mode (linear, ease-in ..)

public AnimationTimingMode TimingMode { get; set; }

Property Value

AnimationTimingMode

Methods

Animate(Texture[], double)

Animate the sprite texture

public static Animation Animate(Texture[] textures, double timePerFrame)

Parameters

textures Texture[]

list of textures of animation

timePerFrame double

Time per Frame (in seconds)

Returns

Animation

Animation object that can be executed on a SpriteNode

Animate(Texture[], double, bool, bool)

Animate the sprite texture

public static Animation Animate(Texture[] textures, double timePerFrame, bool resize, bool restore)

Parameters

textures Texture[]

list of textures of animation

timePerFrame double

Time per Frame (in seconds)

resize bool

resize SpriteNode according to texture

restore bool

Restore SpriteNode to original texture when animation is finished or removed

Returns

Animation

Animation object that can be executed on a SpriteNode

Colorize(Color, float, double)

Animate sprite tint color

public static Animation Colorize(Color color, float colorBlendFactor, double duration)

Parameters

color Color

Final tint color of Sprite

colorBlendFactor float

Final color blend factor

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

Colorize(Color, float, TimeSpan)

Animate sprite tint color

public static Animation Colorize(Color color, float colorBlendFactor, TimeSpan duration)

Parameters

color Color

Final tint color of Sprite

colorBlendFactor float

Final color blend factor

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

Colorize(float, double)

Animate sprite tint color

public static Animation Colorize(float colorBlendFactor, double duration)

Parameters

colorBlendFactor float

Final color blend factor

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

Colorize(float, TimeSpan)

Animate sprite tint color

public static Animation Colorize(float colorBlendFactor, TimeSpan duration)

Parameters

colorBlendFactor float

Final color blend factor

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

Custom(double, Action<Node, float>)

Execute the callback over the execution of animation

public static Animation Custom(double duration, Action<Node, float> callback)

Parameters

duration double

Duration in seconds

callback Action<Node, float>

Called along the execution of the animation

Returns

Animation

Custom animation object

Custom(TimeSpan, Action<Node, float>)

Execute the callback over the execution of animation

public static Animation Custom(TimeSpan duration, Action<Node, float> callback)

Parameters

duration TimeSpan

Duration in seconds

callback Action<Node, float>

Called along the execution of the animation

Returns

Animation

Custom animation object

Equals(object)

Equals(obj)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

FadeAlphaBy(float, double)

Change the alpha of node

public static Animation FadeAlphaBy(float delta, double duration)

Parameters

delta float

alpha factor

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

FadeAlphaBy(float, TimeSpan)

Change the alpha of node

public static Animation FadeAlphaBy(float delta, TimeSpan duration)

Parameters

delta float

alpha factor

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

FadeAlphaTo(float, double)

Animate new alpha of node

public static Animation FadeAlphaTo(float alpha, double duration)

Parameters

alpha float

Final alpha

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

FadeAlphaTo(float, TimeSpan)

Animate new alpha of node

public static Animation FadeAlphaTo(float alpha, TimeSpan duration)

Parameters

alpha float

Final alpha

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

FadeIn(double)

Change the alpha to 1.0

public static Animation FadeIn(double duration)

Parameters

duration double

duration in seconds

Returns

Animation

Animation object that can be executed on a Node

FadeIn(TimeSpan)

Change the alpha to 1.0

public static Animation FadeIn(TimeSpan duration)

Parameters

duration TimeSpan

duration

Returns

Animation

Animation object that can be executed on a Node

FadeOut(double)

Change the alpha to 0.0

public static Animation FadeOut(double duration)

Parameters

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

FadeOut(TimeSpan)

Change the alpha to 0.0

public static Animation FadeOut(TimeSpan duration)

Parameters

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

GetHashCode()

Animation GetHashCode

public override int GetHashCode()

Returns

int

Group(params Animation[])

Create an Animation that groups a set of other animations, The animations will run in parallel (e.g Rotate + Fade at the same time)

public static Animation Group(params Animation[] animations)

Parameters

animations Animation[]

Array of animations to be grouped

Returns

Animation

Animation object that can be executed on a Node

Hide()

Hide the node

public static Animation Hide()

Returns

Animation

Animation object that can be executed on a Node

LookAt(PointF, double)

Rotate node facing target point

public static Animation LookAt(PointF target, double duration)

Parameters

target PointF
duration double

Returns

Animation

LookAt(PointF, TimeSpan)

Rotate node facing target point

public static Animation LookAt(PointF target, TimeSpan duration)

Parameters

target PointF
duration TimeSpan

Returns

Animation

MoveBy(Vector2, double)

Move a node vertically and horizontally relative to the current position

public static Animation MoveBy(Vector2 delta, double duration)

Parameters

delta Vector2

Delta to move

duration double

Duration (in Seconds)

Returns

Animation

Animation object that can be executed on a Node

MoveBy(Vector2, TimeSpan)

Move a node vertically and horizontally relative to the current position

public static Animation MoveBy(Vector2 delta, TimeSpan duration)

Parameters

delta Vector2

Delta to move

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveBy(float, float, double)

Move a node vertically and horizontally relative to the current position

public static Animation MoveBy(float deltaX, float deltaY, double duration)

Parameters

deltaX float

Delta X

deltaY float

Delta Y

duration double

Duration (in Seconds)

Returns

Animation

Animation object that can be executed on a Node

MoveBy(float, float, TimeSpan)

Move a node vertically and horizontally relative to the current position

public static Animation MoveBy(float deltaX, float deltaY, TimeSpan duration)

Parameters

deltaX float

Delta X

deltaY float

Delta Y

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveForever(Vector2)

Move node with given velocity indefinitely

public static Animation MoveForever(Vector2 velocity)

Parameters

velocity Vector2

Velocity in points/second

Returns

Animation

MoveTo(PointF, double)

Move node to a new position

public static Animation MoveTo(PointF location, double duration)

Parameters

location PointF

New node position

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

MoveTo(PointF, TimeSpan)

Move node to a new position

public static Animation MoveTo(PointF location, TimeSpan duration)

Parameters

location PointF

New node position

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveToX(float, double)

Move node horizontally

public static Animation MoveToX(float x, double duration)

Parameters

x float

New node X position

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

MoveToX(float, TimeSpan)

Move node horizontally

public static Animation MoveToX(float x, TimeSpan duration)

Parameters

x float

New node X position

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveToY(float, double)

Move node vertically

public static Animation MoveToY(float y, double duration)

Parameters

y float

New node Y position

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

MoveToY(float, TimeSpan)

Move node vertically

public static Animation MoveToY(float y, TimeSpan duration)

Parameters

y float

New node Y position

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveXBy(float, double)

Move a node horizontally relative to the current position

public static Animation MoveXBy(float deltaX, double duration)

Parameters

deltaX float

Delta X

duration double

Duration (in Seconds)

Returns

Animation

Animation object that can be executed on a Node

MoveXBy(float, TimeSpan)

Move a node horizontally relative to the current position

public static Animation MoveXBy(float deltaX, TimeSpan duration)

Parameters

deltaX float

Delta X

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveXForever(float)

Move node with given X velocity indefinitely

public static Animation MoveXForever(float xVelocity)

Parameters

xVelocity float

Speed in points/second

Returns

Animation

MoveYBy(float, double)

Move a node vertically relative to the current position

public static Animation MoveYBy(float deltaY, double duration)

Parameters

deltaY float

Delta Y

duration double

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveYBy(float, TimeSpan)

Move a node vertically relative to the current position

public static Animation MoveYBy(float deltaY, TimeSpan duration)

Parameters

deltaY float

Delta Y

duration TimeSpan

Duration

Returns

Animation

Animation object that can be executed on a Node

MoveYForever(float)

Move node with given Y velocity indefinitely

public static Animation MoveYForever(float yVelocity)

Parameters

yVelocity float

Speed in points/second

Returns

Animation

OrbitNode(Node, double, double, double)

Rotate Node around another Node

public static Animation OrbitNode(Node center, double angle, double duration, double factor = 1)

Parameters

center Node
angle double
duration double
factor double

Radius factor for the end of the orbit (1 remain same)

Returns

Animation

OrbitNode(Node, double, TimeSpan, double)

Rotate Node around another Node

public static Animation OrbitNode(Node center, double angle, TimeSpan duration, double factor = 1)

Parameters

center Node
angle double
duration TimeSpan
factor double

Radius factor for the end of the orbit (1 remain same)

Returns

Animation

OrbitPoint(PointF, double, double, double)

Rotate Node around a pivot

public static Animation OrbitPoint(PointF center, double angle, double duration, double factor = 1)

Parameters

center PointF
angle double
duration double
factor double

Radius factor for the end of the orbit (1 remain same)

Returns

Animation

OrbitPoint(PointF, double, TimeSpan, double)

Rotate Node around a pivot

public static Animation OrbitPoint(PointF center, double angle, TimeSpan duration, double factor = 1)

Parameters

center PointF
angle double
duration TimeSpan
factor double

Radius factor for the end of the orbit (1 remain same)

Returns

Animation

RemoveFromParent()

When performed, removed the Node from the parent.

public static Animation RemoveFromParent()

Returns

Animation

Animation object that can be executed on a Node

Repeat(Animation, int)

Repeat animation N times

public static Animation Repeat(Animation animation, int count)

Parameters

animation Animation

Animation to be repeated

count int

Number of times to repeat

Returns

Animation

Animation object that can be executed on a Node

RepeatForever(Animation)

Repeat animation forever

public static Animation RepeatForever(Animation animation)

Parameters

animation Animation

Animation to be repeated forever

Returns

Animation

Animation object that can be executed on a Node

ResizeTo(SizeF, double)

Resize a SpriteNode

public static Animation ResizeTo(SizeF size, double duration)

Parameters

size SizeF

New size of SpriteNode

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

ResizeTo(SizeF, TimeSpan)

Resize a SpriteNode

public static Animation ResizeTo(SizeF size, TimeSpan duration)

Parameters

size SizeF

New size of SpriteNode

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

ResizeToHeight(float, double)

Change SpriteNode Height

public static Animation ResizeToHeight(float height, double duration)

Parameters

height float

New height of SpriteNode

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

ResizeToHeight(float, TimeSpan)

Change SpriteNode Height

public static Animation ResizeToHeight(float height, TimeSpan duration)

Parameters

height float

New height of SpriteNode

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

ResizeToWidth(float, double)

Change SpriteNode width

public static Animation ResizeToWidth(float width, double duration)

Parameters

width float

New width of SpriteNode

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

ResizeToWidth(float, TimeSpan)

Change SpriteNode width

public static Animation ResizeToWidth(float width, TimeSpan duration)

Parameters

width float

New width of SpriteNode

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a SpriteNode

RotateBy(double, double)

Rotate by a angle delta

public static Animation RotateBy(double radians, double duration)

Parameters

radians double

delta angle in radians

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

RotateBy(double, TimeSpan)

Rotate by a angle delta

public static Animation RotateBy(double radians, TimeSpan duration)

Parameters

radians double

delta angle in radians

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

RotateForever(double)

Rotate indefinitely given with angular velocity

public static Animation RotateForever(double angularVelocity)

Parameters

angularVelocity double

Angular velocity in radians/second

Returns

Animation

RotateTo(double, double)

Rotate to the given angle

public static Animation RotateTo(double radians, double duration)

Parameters

radians double

Final angle in radians

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

RotateTo(double, TimeSpan)

Rotate to the given angle

public static Animation RotateTo(double radians, TimeSpan duration)

Parameters

radians double

Final angle in radians

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

RunAction(Action)

Run a action callback

public static Animation RunAction(Action action)

Parameters

action Action

Action to be invoked when animation is executed

Returns

Animation

Animation object that can be executed on a Node

ScaleBy(float, double)

Animate node applying a new scale

public static Animation ScaleBy(float scale, double duration)

Parameters

scale float

Scale factor

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleBy(float, TimeSpan)

Animate node applying a new scale

public static Animation ScaleBy(float scale, TimeSpan duration)

Parameters

scale float

Scale factor

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(SizeF, double)

Change scale to make node reach new size

public static Animation ScaleTo(SizeF size, double duration)

Parameters

size SizeF

New size of Node

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(SizeF, TimeSpan)

Change scale to make node reach new size

public static Animation ScaleTo(SizeF size, TimeSpan duration)

Parameters

size SizeF

New size of Node

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(float, double)

Set node to a new scale

public static Animation ScaleTo(float newScale, double duration)

Parameters

newScale float

Final scale of Node

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(float, float, double)

Set node to a new scale

public static Animation ScaleTo(float xScale, float yScale, double duration)

Parameters

xScale float

Final xscale of Node

yScale float

Final yscale of Node

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(float, float, TimeSpan)

Set node to a new scale

public static Animation ScaleTo(float xScale, float yScale, TimeSpan duration)

Parameters

xScale float

Final xscale of Node

yScale float

Final yscale of Node

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleTo(float, TimeSpan)

Set node to a new scale

public static Animation ScaleTo(float newScale, TimeSpan duration)

Parameters

newScale float

Final scale of Node

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleXTo(float, double)

Change X scale

public static Animation ScaleXTo(float xscale, double duration)

Parameters

xscale float

Final xscale of Node

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleXTo(float, TimeSpan)

Change X scale

public static Animation ScaleXTo(float xscale, TimeSpan duration)

Parameters

xscale float

Final xscale of Node

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleYTo(float, double)

Change Y scale

public static Animation ScaleYTo(float yscale, double duration)

Parameters

yscale float

Final yscale of Node

duration double

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

ScaleYTo(float, TimeSpan)

Change Y scale

public static Animation ScaleYTo(float yscale, TimeSpan duration)

Parameters

yscale float

Final yscale of Node

duration TimeSpan

Duration in seconds

Returns

Animation

Animation object that can be executed on a Node

Sequence(params Animation[])

Create a sequence animation from a list of Animations, Each animation will executed in sequence a1 -> a2 -> a3

public static Animation Sequence(params Animation[] animations)

Parameters

animations Animation[]

Array of animations

Returns

Animation

Animation object that can be executed on a Node

SetTexture(Texture)

Set new texture to SpriteNode

public static Animation SetTexture(Texture texture)

Parameters

texture Texture

Texture to be applied to SpriteNode

Returns

Animation

Animation object that can be executed on a SpriteNode

SetTexture(Texture, bool)

Set new texture to SpriteNode

public static Animation SetTexture(Texture texture, bool resize)

Parameters

texture Texture

Texture to be applied to SpriteNode

resize bool

Flag to control if the SpriteNode should be resized to the size of texture

Returns

Animation

Animation object that can be executed on a SpriteNode

Shake(double)

Shake node animation

public static Animation Shake(double duration)

Parameters

duration double

Returns

Animation

Shake(Vector2, double)

Shake node animation

public static Animation Shake(Vector2 delta, double duration)

Parameters

delta Vector2
duration double

Returns

Animation

Shake(Vector2, TimeSpan)

Shake node animation

public static Animation Shake(Vector2 delta, TimeSpan duration)

Parameters

delta Vector2
duration TimeSpan

Returns

Animation

Shake(TimeSpan)

Shake node animation

public static Animation Shake(TimeSpan duration)

Parameters

duration TimeSpan

Returns

Animation

SineHorizontal(float, float, double)

Oscillate node vertical position using a Sine wave

public static Animation SineHorizontal(float amplitude, float frequency, double duration)

Parameters

amplitude float

Amplitude of sine movement

frequency float

Frequency of oscillation

duration double

Duration of oscillation in seconds

Returns

Animation

SineHorizontal(float, float, TimeSpan)

Oscillate node vertical position using a Sine wave

public static Animation SineHorizontal(float amplitude, float frequency, TimeSpan duration)

Parameters

amplitude float

Amplitude of sine movement

frequency float

Frequency of oscillation

duration TimeSpan

Duration of oscillation

Returns

Animation

SineVertical(float, float, double)

Oscillate node vertical position using a Sine wave

public static Animation SineVertical(float amplitude, float frequency, double duration)

Parameters

amplitude float

Amplitude of sine movement

frequency float

Frequency of oscillation

duration double

Duration of oscillation in seconds

Returns

Animation

SineVertical(float, float, TimeSpan)

Oscillate node vertical position using a Sine wave

public static Animation SineVertical(float amplitude, float frequency, TimeSpan duration)

Parameters

amplitude float

Amplitude of sine movement

frequency float

Frequency of oscillation

duration TimeSpan

Duration of oscillation in seconds

Returns

Animation

Unhide()

Unhide node

public static Animation Unhide()

Returns

Animation

Animation object that can be executed on a Node

Wait(double)

Wait, useful to chain with other animations (e.g Rotate then Wait then Fade Out)

public static Animation Wait(double duration)

Parameters

duration double

Time to wait, in seconds

Returns

Animation

Animation object that can be executed on a Node

Wait(TimeSpan)

Wait, useful to chain with other animations (e.g Rotate then Wait then Fade Out)

public static Animation Wait(TimeSpan duration)

Parameters

duration TimeSpan

Returns

Animation