Animations Guides
Using AnimationsFunctions
Animation Count
Returns the number of Animation
s within an Animation Script
.
- Return Type
-
Integer
Returns an
Integer
equal to the total number of animations in the script. - Parameters
-
Name Type Description Script The
Animation Script
to count the animations in. - Signatures
-
int animation_count(animation_script script)
public int AnimationScript.AnimationCount { get } public static int SplashKit.AnimationCount(AnimationScript script);
function AnimationCount(script: AnimationScript): Integer
def animation_count(script):
Animation Current Cell
Returns the current cell (the part of the image or sprite) of this animation. This can be used to animate an image or sprite.
- Return Type
-
Integer
Returns the current cell of the animation passed to the method.
- Parameters
-
Name Type Description Anim The
Animation
to return the cell of. - Signatures
-
int animation_current_cell(animation anim)
public int Animation.CurrentCell { get } public static int SplashKit.AnimationCurrentCell(Animation anim);
function AnimationCurrentCell(anim: Animation): Integer
def animation_current_cell(anim):
Animation Current Vector
Returns the Vector 2D
assigned to the current frame in the animation.
- Return Type
-
Returns the
Vector 2D
assigned to the current frame in the animation. - Parameters
-
Name Type Description Anim The animation to check the vector of.
- Signatures
-
vector_2d animation_current_vector(animation anim)
public Vector2D Animation.CurrentVector { get } public static Vector2D SplashKit.AnimationCurrentVector(Animation anim);
function AnimationCurrentVector(anim: Animation): Vector2D
def animation_current_vector(anim):
Animation Ended
Checks if an Animation
has ended.
- Return Type
-
Boolean
Returns a
Boolean
denoting whether theAnimation
has ended. - Parameters
-
Name Type Description Anim The animation to check.
- Signatures
-
bool animation_ended(animation anim)
public bool Animation.Ended { get } public static bool SplashKit.AnimationEnded(Animation anim);
function AnimationEnded(anim: Animation): Boolean
def animation_ended(anim):
Animation Entered Frame
Returns true if the Animation
entered a new frame on its last update.
This can be used to trigger actions on frames within an animation.
- Return Type
-
Boolean
Returns a
Boolean
denoting whether theAnimation
has ended. - Parameters
-
Name Type Description Anim The animation to check.
- Signatures
-
bool animation_entered_frame(animation anim)
public bool Animation.EnteredFrame { get } public static bool SplashKit.AnimationEnteredFrame(Animation anim);
function AnimationEnteredFrame(anim: Animation): Boolean
def animation_entered_frame(anim):
Animation Frame Time
Returns the amount of time spent in the current frame. When this exceeds the frames duration the animation moves to the next frame.
- Return Type
-
Float
Returns the amount of time spent in the current frame as a
Float
. - Parameters
-
Name Type Description Anim The animation to check.
- Signatures
-
float animation_frame_time(animation anim)
public float Animation.FrameTime { get } public static float SplashKit.AnimationFrameTime(Animation anim);
function AnimationFrameTime(anim: Animation): Single
def animation_frame_time(anim):
Animation Index
Searches an Animation Script
for an Animation
and returns its
index.
- Return Type
-
Integer
Returns the index of the
Animation
in theAnimation Script
- Parameters
-
Name Type Description Script The
Animation Script
to look for theAnimation
in.Name String
The name of the
Animation
to look for. - Signatures
-
int animation_index(animation_script script, const string &name)
public int AnimationScript.AnimationIndex(string name); public static int SplashKit.AnimationIndex(AnimationScript script, string name);
function AnimationIndex(script: AnimationScript; const name: String): Integer
def animation_index(script, name):
Animation Name
Searches an Animation Script
for an animation and returns its name.
- Return Type
-
String
Returns the name of the
Animation
in theAnimation Script
. - Parameters
-
Name Type Description Temp The
Animation
to search for. - Signatures
-
string animation_name(animation temp)
public string Animation.Name { get } public static string SplashKit.AnimationName(Animation temp);
function AnimationName(temp: Animation): String
def animation_name(temp):
Animation Script Name
Retuns the name of an Animation Script
.
- Return Type
-
String
Returns a
String
that is the name of the animation script passed to the method. - Parameters
-
Name Type Description Script The
Animation Script
to return the name of. - Signatures
-
string animation_script_name(animation_script script)
public string AnimationScript.Name { get } public static string SplashKit.AnimationScriptName(AnimationScript script);
function AnimationScriptName(script: AnimationScript): String
def animation_script_name(script):
Animation Script Named
Loads and returns a Animation Script
. The supplied filename is
used to locate the Animation Script
to load. The supplied name
indicates the name to use to refer to this in SplashKit. The
Animation Script
can then be retrieved by passing this name to
the animationscriptnamed method.
- Return Type
-
Returns the newly loaded
Animation Script
. - Parameters
-
Name Type Description Name String
Indicates the name used to locate the animation_script to load
- Signatures
-
animation_script animation_script_named(const string &name)
public static AnimationScript Animation.AnimationScriptNamed(string name); public static AnimationScript SplashKit.AnimationScriptNamed(string name);
function AnimationScriptNamed(const name: String): AnimationScript
def animation_script_named(name):
Assign Animation
-
Assign Animation
(
anim
:
Animation
script :Animation Script
name :String
) -
Assign Animation
(
anim
:
Animation
script :Animation Script
name :String
with_sound :Boolean
) -
Assign Animation
(
anim
:
Animation
script :Animation Script
idx :Integer
) -
Assign Animation
(
anim
:
Animation
script :Animation Script
idx :Integer
with_sound :Boolean
) -
Assign Animation
(
anim
:
Animation
script_name :String
name :String
) -
Assign Animation
(
anim
:
Animation
script_name :String
name :String
with_sound :Boolean
) -
Assign Animation
(
anim
:
Animation
idx :Integer
) -
Assign Animation
(
anim
:
Animation
idx :Integer
with_sound :Boolean
) -
Assign Animation
(
anim
:
Animation
name :String
) -
Assign Animation
(
anim
:
Animation
name :String
with_sound :Boolean
)
Assign Animation
Setup an Animation
to follow the script from an indicated name.
This will switch the animation to use the supplied script.
It locates the name of the animation with the animation script and
sets the Anim
to start at that point in the script.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script The
Animation Script
to assign theAnimation
to.Name String
The name of the
Animation
to be assigned. - Signatures
-
void assign_animation(animation anim, animation_script script, const string &name)
public void Animation.AssignAnimation(AnimationScript script, string name); public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, string name);
procedure AssignAnimation(anim: Animation; script: AnimationScript; const name: String)
def assign_animation_with_script(anim, script, name):
Assign Animation
Assigns an Animation
to an Animation Script
. This may play a
sound effect if the animation is set to play a sound effect on its
first frame.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script The
Animation Script
to assign theAnimation
to.Name String
The name of the
Animation
to be assigned.With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void assign_animation(animation anim, animation_script script, const string &name, bool with_sound)
public void Animation.AssignAnimation(AnimationScript script, string name, bool withSound); public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, string name, bool withSound);
procedure AssignAnimation(anim: Animation; script: AnimationScript; const name: String; withSound: Boolean)
def assign_animation_with_script_and_sound(anim, script, name, with_sound):
Assign Animation
Assigns an Animation
to an Animation Script
.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script The
Animation Script
to assign theAnimation
to.Idx Integer
The index of the
Animation
to create. - Signatures
-
void assign_animation(animation anim, animation_script script, int idx)
public void Animation.AssignAnimation(AnimationScript script, int idx); public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, int idx);
procedure AssignAnimation(anim: Animation; script: AnimationScript; idx: Integer)
def assign_animation_index_with_script(anim, script, idx):
Assign Animation
Assigns an Animation
to an Animation Script
. This may play a
sound effect if the animation is set to play a sound effect on its
first frame.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script The
Animation Script
to assign theAnimation
to.Idx Integer
The index of the
Animation
to create.With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void assign_animation(animation anim, animation_script script, int idx, bool with_sound)
public void Animation.AssignAnimation(AnimationScript script, int idx, bool withSound); public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, int idx, bool withSound);
procedure AssignAnimation(anim: Animation; script: AnimationScript; idx: Integer; withSound: Boolean)
def assign_animation_index_with_script_and_sound(anim, script, idx, with_sound):
Assign Animation
Assigns an Animation
to an Animation Script
.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script Name String
The name of the
Animation Script
to assign theAnimation
to.Name String
The name of the
Animation
to be assigned. - Signatures
-
void assign_animation(animation anim, const string &script_name, const string &name)
public void Animation.AssignAnimation(string scriptName, string name); public static void SplashKit.AssignAnimation(Animation anim, string scriptName, string name);
procedure AssignAnimation(anim: Animation; const scriptName: String; const name: String)
def assign_animation_with_script_named(anim, script_name, name):
Assign Animation
Assigns an Animation
to an Animation Script
. This may play a
sound effect if the animation is set to play a sound effect on its
first frame.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Script Name String
The name of the
Animation Script
to assign theAnimation
to.Name String
The name of the
Animation
to be assignedWith Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void assign_animation(animation anim, const string &script_name, const string &name, bool with_sound)
public void Animation.AssignAnimation(string scriptName, string name, bool withSound); public static void SplashKit.AssignAnimation(Animation anim, string scriptName, string name, bool withSound);
procedure AssignAnimation(anim: Animation; const scriptName: String; const name: String; withSound: Boolean)
def assign_animation_with_script_named_and_sound(anim, script_name, name, with_sound):
Assign Animation
Setup an Animation
to follow the script from an indicated index.
This uses the index from the current animation script and
sets the supplied animation to start at that point in the script.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Idx Integer
The index of the animation to use from its current script.
- Signatures
-
void assign_animation(animation anim, int idx)
public void Animation.AssignAnimation(int idx); public static void SplashKit.AssignAnimation(Animation anim, int idx);
procedure AssignAnimation(anim: Animation; idx: Integer)
def assign_animation_index(anim, idx):
Assign Animation
Setup an Animation
to follow the script from an indicated index.
This uses the index from the current animation script and
sets the supplied animation to start at that point in the script.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Idx Integer
The index of the animation to use from its current script.
With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void assign_animation(animation anim, int idx, bool with_sound)
public void Animation.AssignAnimation(int idx, bool withSound); public static void SplashKit.AssignAnimation(Animation anim, int idx, bool withSound);
procedure AssignAnimation(anim: Animation; idx: Integer; withSound: Boolean)
def assign_animation_index_with_sound(anim, idx, with_sound):
Assign Animation
Setup an Animation
to follow the script from an indicated name.
This locates the name of the animation from the current animation script and
sets the supplied animation to start at that point in the script.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Name String
The name of the animation to use from its current script.
- Signatures
-
void assign_animation(animation anim, string name)
public void Animation.AssignAnimation(string name); public static void SplashKit.AssignAnimation(Animation anim, string name);
procedure AssignAnimation(anim: Animation; name: String)
def assign_animation(anim, name):
Assign Animation
Setup an Animation
to follow the script from an indicated name.
This locates the name of the animation from the current animation script and
sets the supplied animation to start at that point in the script.
- Parameters
-
Name Type Description Anim The
Animation
to be assigned.Name String
The name of the animation to use from its current script.
With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void assign_animation(animation anim, string name, bool with_sound)
public void Animation.AssignAnimation(string name, bool withSound); public static void SplashKit.AssignAnimation(Animation anim, string name, bool withSound);
procedure AssignAnimation(anim: Animation; name: String; withSound: Boolean)
def assign_animation_with_sound(anim, name, with_sound):
Create Animation
-
Create Animation
(
script
:
Animation Script
idx :Integer
with_sound :Boolean
) -
Create Animation
(
script
:
Animation Script
name :String
) -
Create Animation
(
script
:
Animation Script
name :String
with_sound :Boolean
) -
Create Animation
(
script_name
:
String
name :String
) -
Create Animation
(
script_name
:
String
name :String
with_sound :Boolean
)
Create Animation
Creates an animation from an Animation Script
. This may play a
sound effect if the animation is set to play a sound effect on its
first frame.
- Return Type
-
Returns the newly created
Animation Script
. - Parameters
-
Name Type Description Script The
Animation Script
to create theAnimation
from.Idx Integer
The index of the
Animation
to create.With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
animation create_animation(animation_script script, int idx, bool with_sound)
public static Animation Animation.CreateAnimation(AnimationScript script, int idx, bool withSound); public static Animation SplashKit.CreateAnimation(AnimationScript script, int idx, bool withSound);
function CreateAnimation(script: AnimationScript; idx: Integer; withSound: Boolean): Animation
def create_animation_from_index_with_sound(script, idx, with_sound):
- Guides
- Using Animations
Create Animation
Creates an animation from an Animation Script
.
- Return Type
-
Returns the newly created
Animation
- Parameters
-
Name Type Description Script The
Animation Script
to create theAnimation
fromName String
The name for the new
Animation
- Signatures
-
animation create_animation(animation_script script, const string &name)
public Animation AnimationScript.CreateAnimation(string name); public static Animation SplashKit.CreateAnimation(AnimationScript script, string name);
function CreateAnimation(script: AnimationScript; const name: String): Animation
def create_animation(script, name):
- Guides
- Using Animations
Create Animation
Creates an animation from a Animation Script
. This may play a
sound effect if the animation is set to play a sound effect on
its first frame.
- Return Type
-
Returns the newly created
Animation
. - Parameters
-
Name Type Description Script The
Animation Script
to create theAnimation
fromName String
The name for the new
Animation
With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
animation create_animation(animation_script script, const string &name, bool with_sound)
public Animation AnimationScript.CreateAnimation(string name, bool withSound); public static Animation SplashKit.CreateAnimation(AnimationScript script, string name, bool withSound);
function CreateAnimation(script: AnimationScript; const name: String; withSound: Boolean): Animation
def create_animation_with_sound(script, name, with_sound):
- Guides
- Using Animations
Create Animation
Creates an animation from an Animation Script
's name. This may
play a sound effect if the animation is set to play a sound effect
on its first frame.
- Return Type
-
Returns the newly created
Animation
- Parameters
-
Name Type Description Script Name String
The name of the
Animation Script
to create theAnimation
fromName String
The name for the new
Animation
- Signatures
-
animation create_animation(const string &script_name, const string &name)
public static Animation Animation.CreateAnimation(string scriptName, string name); public static Animation SplashKit.CreateAnimation(string scriptName, string name);
function CreateAnimation(const scriptName: String; const name: String): Animation
def create_animation_from_script_named(script_name, name):
- Guides
- Using Animations
Create Animation
Creates an animation from an Animation Script
's name. This may
play a sound effect if the animation is set to play a sound effect
on its first frame.
- Return Type
-
Returns the newly created
Animation
- Parameters
-
Name Type Description Script Name String
The name of the
Animation Script
to create theAnimation
fromName String
The name for the new
Animation
With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
animation create_animation(const string &script_name, const string &name, bool with_sound)
public static Animation Animation.CreateAnimation(string scriptName, string name, bool withSound); public static Animation SplashKit.CreateAnimation(string scriptName, string name, bool withSound);
function CreateAnimation(const scriptName: String; const name: String; withSound: Boolean): Animation
def create_animation_from_script_named_with_sound(script_name, name, with_sound):
- Guides
- Using Animations
Free All Animation Scripts
Frees all loaded Animation Script
s.
- Signatures
-
void free_all_animation_scripts()
public static void Animation.FreeAllAnimationScripts(); public static void SplashKit.FreeAllAnimationScripts();
procedure FreeAllAnimationScripts()
def free_all_animation_scripts():
Free Animation
Disposes of the resources used in the animation.
Free Animation Script
Free Animation Script
Frees loaded animation frames data. Use this when you will no longer be using the animation for any purpose, including within sprite.
- Parameters
-
Name Type Description Script To Free The
Animation Script
to be freed. - Signatures
-
void free_animation_script(animation_script script_to_free)
public void AnimationScript.FreeAnimationScript(); public static void SplashKit.FreeAnimationScript(AnimationScript scriptToFree);
procedure FreeAnimationScript(scriptToFree: AnimationScript)
def free_animation_script(script_to_free):
Free Animation Script
Frees loaded Animation Script
data. Use this when you will no
longer be using the animation for any purpose, including within
sprite.
- Parameters
-
Name Type Description Name String
The name of the
Animation Script
to be freed. - Signatures
-
void free_animation_script(const string &name)
public static void Animation.FreeAnimationScript(string name); public static void SplashKit.FreeAnimationScript(string name);
procedure FreeAnimationScript(const name: String)
def free_animation_script_with_name(name):
Has Animation Named
Returns whether an Animation Script
has been loaded with the
given name.
- Return Type
-
Boolean
Returns a
Boolean
that denotes whether theAnimation Script
has been loaded. - Parameters
-
Name Type Description Script The
Animation Script
to check.Name String
The name of the
Animation Script
to look for. - Signatures
-
bool has_animation_named(animation_script script, const string &name)
public bool AnimationScript.HasAnimationNamed(string name); public static bool SplashKit.HasAnimationNamed(AnimationScript script, string name);
function HasAnimationNamed(script: AnimationScript; const name: String): Boolean
def has_animation_named(script, name):
Has Animation Script
Determines if SplashKit has animation frames loaded for the supplied name. This checks against all loaded animation frames, those loaded without a name are assigned the filename as a default.
- Return Type
-
Boolean
Returns the
Boolean
that denotes if the animation has theAnimation Script
- Parameters
-
Name Type Description Name String
The name of the animation script to look for.
- Signatures
-
bool has_animation_script(const string &name)
public static bool Animation.HasAnimationScript(string name); public static bool SplashKit.HasAnimationScript(string name);
function HasAnimationScript(const name: String): Boolean
def has_animation_script(name):
Load Animation Script
Load animation details from an animation frames file.
- Return Type
-
Returns the newly loaded
Animation Script
. - Parameters
-
Name Type Description Name String
The name of the
Animation Script
.Filename String
The file to load the
Animation Script
from. - Signatures
-
animation_script load_animation_script(const string &name, const string &filename)
public static AnimationScript SplashKit.LoadAnimationScript(string name, string filename); public AnimationScript(string name, string filename);
function LoadAnimationScript(const name: String; const filename: String): AnimationScript
def load_animation_script(name, filename):
- Guides
- Using Animations
Restart Animation
Restart Animation
Restarts an Animation
.
- Parameters
-
Name Type Description Anim The
Animation
to restart. - Signatures
-
void restart_animation(animation anim)
public void Animation.RestartAnimation(); public static void SplashKit.RestartAnimation(Animation anim);
procedure RestartAnimation(anim: Animation)
def restart_animation(anim):
Restart Animation
Restarts an Animation
. This may play a sound effect if the first
frame triggers a sound.
- Parameters
-
Name Type Description Anim The
Animation
to restart.With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void restart_animation(animation anim, bool with_sound)
public void Animation.RestartAnimation(bool withSound); public static void SplashKit.RestartAnimation(Animation anim, bool withSound);
procedure RestartAnimation(anim: Animation; withSound: Boolean)
def restart_animation_with_sound(anim, with_sound):
Update Animation
Update Animation
Updates the animation, updating the time spent and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Parameters
-
Name Type Description Anim The
Animation
to update.Pct Float
The amount that the frame time will be incremented
With Sound Boolean
Denotes whether the
Animation
should play audio. - Signatures
-
void update_animation(animation anim, float pct, bool with_sound)
public static void Animation.UpdateAnimation(Animation anim, float pct, bool withSound); public static void SplashKit.UpdateAnimation(Animation anim, float pct, bool withSound);
procedure UpdateAnimation(anim: Animation; pct: Single; withSound: Boolean)
def update_animation_percent_with_sound(anim, pct, with_sound):
- Guides
- Using Animations
Update Animation
Updates the animation, updating the time spent and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Parameters
-
Name Type Description Anim The
Animation
to update. - Signatures
-
void update_animation(animation anim)
public void Animation.UpdateAnimation(); public static void SplashKit.UpdateAnimation(Animation anim);
procedure UpdateAnimation(anim: Animation)
def update_animation(anim):
- Guides
- Using Animations
Update Animation
Updates the animation, updating the time spent and possibly moving to a new frame in the animation. This may play a sound effect if the new frame triggers a sound.
- Parameters
-
Name Type Description Anim The
Animation
to update.Pct Float
The amount that the frame time will be incremented
- Signatures
-
void update_animation(animation anim, float pct)
public void Animation.UpdateAnimation(float pct); public static void SplashKit.UpdateAnimation(Animation anim, float pct);
procedure UpdateAnimation(anim: Animation; pct: Single)
def update_animation_percent(anim, pct):
- Guides
- Using Animations