Animations
Functions
Animation Count
Returns the number of Animation
s within an Animation Script
.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to count the animations in. |
Return Type: Integer
Signatures:
int animation_count(animation_script script)
public int AnimationScript.AnimationCount { get }public static int SplashKit.AnimationCount(AnimationScript script);
def animation_count(script):
function AnimationCount(script: AnimationScript): Integer
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.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The Animation to return the cell of. |
Return Type: Integer
Signatures:
int animation_current_cell(animation anim)
public int Animation.CurrentCell { get }public static int SplashKit.AnimationCurrentCell(Animation anim);
def animation_current_cell(anim):
function AnimationCurrentCell(anim: Animation): Integer
Animation Current Vector
Returns the Vector 2d
assigned to the current frame in the animation.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The animation to check the vector of. |
Return Type: Vector 2d
Signatures:
vector_2d animation_current_vector(animation anim)
public Vector2D Animation.CurrentVector { get }public static Vector2D SplashKit.AnimationCurrentVector(Animation anim);
def animation_current_vector(anim):
function AnimationCurrentVector(anim: Animation): Vector2D
Animation Ended
Checks if an Animation
has ended.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The animation to check. |
Return Type: Boolean
Signatures:
bool animation_ended(animation anim)
public bool Animation.Ended { get }public static bool SplashKit.AnimationEnded(Animation anim);
def animation_ended(anim):
function AnimationEnded(anim: Animation): Boolean
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.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The animation to check. |
Return Type: Boolean
Signatures:
bool animation_entered_frame(animation anim)
public bool Animation.EnteredFrame { get }public static bool SplashKit.AnimationEnteredFrame(Animation anim);
def animation_entered_frame(anim):
function AnimationEnteredFrame(anim: Animation): Boolean
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.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The animation to check. |
Return Type: Float
Signatures:
float animation_frame_time(animation anim)
public float Animation.FrameTime { get }public static float SplashKit.AnimationFrameTime(Animation anim);
def animation_frame_time(anim):
function AnimationFrameTime(anim: Animation): Single
Animation Index
Searches an Animation Script
for an Animation
and returns its index.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to look for the Animation in. |
name | String | The name of the Animation to look for. |
Return Type: Integer
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);
def animation_index(script, name):
function AnimationIndex(script: AnimationScript; const name: String): Integer
Animation Name
Searches an Animation Script
for an animation and returns its name.
Parameters:
Name | Type | Description |
---|---|---|
temp | Animation | The Animation to search for. |
Return Type: String
Signatures:
string animation_name(animation temp)
public string Animation.Name { get }public static string SplashKit.AnimationName(Animation temp);
def animation_name(temp):
function AnimationName(temp: Animation): String
Usage:
Animation Script Name
Retuns the name of an Animation Script
.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to return the name of. |
Return Type: String
Signatures:
string animation_script_name(animation_script script)
public string AnimationScript.Name { get }public static string SplashKit.AnimationScriptName(AnimationScript script);
def animation_script_name(script):
function AnimationScriptName(script: AnimationScript): String
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 animation_script_named method.
Parameters:
Name | Type | Description |
---|---|---|
name | String | Indicates the name used to locate the animation_script to load |
Return Type: Animation Script
Signatures:
animation_script animation_script_named(const string &name)
public static AnimationScript SplashKit.AnimationScriptNamed(string name);
def animation_script_named(name):
function AnimationScriptNamed(const name: String): AnimationScript
Usage:
Assign Animation
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 | Animation | The Animation to be assigned. |
script | Animation Script | The Animation Script to assign the Animation 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.Assign(AnimationScript script, string name);public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, string name);
def assign_animation_with_script(anim, script, name):
procedure AssignAnimation(anim: Animation; script: AnimationScript; const name: String)
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 | Animation | The Animation to be assigned. |
script | Animation Script | The Animation Script to assign the Animation 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.Assign(AnimationScript script, string name, bool withSound);public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, string name, bool withSound);
def assign_animation_with_script_and_sound(anim, script, name, with_sound):
procedure AssignAnimation(anim: Animation; script: AnimationScript; const name: String; withSound: Boolean)
Assign Animation
Assigns an Animation
to an Animation Script
.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The Animation to be assigned. |
script | Animation Script | The Animation Script to assign the Animation to. |
idx | Integer | The index of the Animation to create. |
Signatures:
void assign_animation(animation anim, animation_script script, int idx)
public void Animation.Assign(AnimationScript script, int idx);public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, int idx);
def assign_animation_index_with_script(anim, script, idx):
procedure AssignAnimation(anim: Animation; script: AnimationScript; idx: Integer)
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 | Animation | The Animation to be assigned. |
script | Animation Script | The Animation Script to assign the Animation 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.Assign(AnimationScript script, int idx, bool withSound);public static void SplashKit.AssignAnimation(Animation anim, AnimationScript script, int idx, bool withSound);
def assign_animation_index_with_script_and_sound(anim, script, idx, with_sound):
procedure AssignAnimation(anim: Animation; script: AnimationScript; idx: Integer; withSound: Boolean)
Assign Animation
Assigns an Animation
to an Animation Script
.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The Animation to be assigned. |
script_name | String | The name of the Animation Script to assign the Animation 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.Assign(string scriptName, string name);public static void SplashKit.AssignAnimation(Animation anim, string scriptName, string name);
def assign_animation_with_script_named(anim, script_name, name):
procedure AssignAnimation(anim: Animation; const scriptName: String; const name: String)
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 | Animation | The Animation to be assigned. |
script_name | String | The name of the Animation Script to assign the Animation 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, const string &script_name, const string &name, bool with_sound)
public void Animation.Assign(string scriptName, string name, bool withSound);public static void SplashKit.AssignAnimation(Animation anim, string scriptName, string name, bool withSound);
def assign_animation_with_script_named_and_sound(anim, script_name, name, with_sound):
procedure AssignAnimation(anim: Animation; const scriptName: String; const name: String; withSound: Boolean)
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 | Animation | 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.Assign(int idx);public static void SplashKit.AssignAnimation(Animation anim, int idx);
def assign_animation_index(anim, idx):
procedure AssignAnimation(anim: Animation; idx: Integer)
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 | Animation | 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.Assign(int idx, bool withSound);public static void SplashKit.AssignAnimation(Animation anim, int idx, bool withSound);
def assign_animation_index_with_sound(anim, idx, with_sound):
procedure AssignAnimation(anim: Animation; idx: Integer; withSound: Boolean)
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 | Animation | 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.Assign(string name);public static void SplashKit.AssignAnimation(Animation anim, string name);
def assign_animation(anim, name):
procedure AssignAnimation(anim: Animation; name: String)
Usage:
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 | Animation | 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.Assign(string name, bool withSound);public static void SplashKit.AssignAnimation(Animation anim, string name, bool withSound);
def assign_animation_with_sound(anim, name, with_sound):
procedure AssignAnimation(anim: Animation; name: String; withSound: Boolean)
Create Animation
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.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to create the Animation from. |
idx | Integer | The index of the Animation to create. |
with_sound | Boolean | Denotes whether the Animation should play audio. |
Return Type: Animation
Signatures:
animation create_animation(animation_script script, int idx, bool with_sound)
public static Animation SplashKit.CreateAnimation(AnimationScript script, int idx, bool withSound);
def create_animation_from_index_with_sound(script, idx, with_sound):
function CreateAnimation(script: AnimationScript; idx: Integer; withSound: Boolean): Animation
Create Animation
Creates an animation from an Animation Script
.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to create the Animation from |
name | String | The name for the new Animation |
Return Type: 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);
def create_animation(script, name):
function CreateAnimation(script: AnimationScript; const name: String): Animation
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.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to create the Animation from |
name | String | The name for the new Animation |
with_sound | Boolean | Denotes whether the Animation should play audio. |
Return Type: Animation
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);
def create_animation_with_sound(script, name, with_sound):
function CreateAnimation(script: AnimationScript; const name: String; withSound: Boolean): Animation
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.
Parameters:
Name | Type | Description |
---|---|---|
script_name | String | The name of the Animation Script to create the Animation from |
name | String | The name for the new Animation |
Return Type: Animation
Signatures:
animation create_animation(const string &script_name, const string &name)
public static Animation SplashKit.CreateAnimation(string scriptName, string name);
def create_animation_from_script_named(script_name, name):
function CreateAnimation(const scriptName: String; const name: String): Animation
Usage:
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.
Parameters:
Name | Type | Description |
---|---|---|
script_name | String | The name of the Animation Script to create the Animation from |
name | String | The name for the new Animation |
with_sound | Boolean | Denotes whether the Animation should play audio. |
Return Type: Animation
Signatures:
animation create_animation(const string &script_name, const string &name, bool with_sound)
public static Animation SplashKit.CreateAnimation(string scriptName, string name, bool withSound);
def create_animation_from_script_named_with_sound(script_name, name, with_sound):
function CreateAnimation(const scriptName: String; const name: String; withSound: Boolean): Animation
Free All Animation Scripts
Frees all loaded Animation Script
s.
Signatures:
void free_all_animation_scripts()
public static void Animation.FreeAll();public static void SplashKit.FreeAllAnimationScripts();
def free_all_animation_scripts():
procedure FreeAllAnimationScripts()
Free Animation
Disposes of the resources used in the animation.
Parameters:
Name | Type | Description |
---|---|---|
ani | Animation | The Animation to be disposed of. |
Signatures:
void free_animation(animation ani)
public static void SplashKit.FreeAnimation(Animation ani);
def free_animation(ani):
procedure FreeAnimation(ani: 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 | Animation Script | The Animation Script to be freed. |
Signatures:
void free_animation_script(animation_script script_to_free)
public static void SplashKit.FreeAnimationScript(AnimationScript scriptToFree);
def free_animation_script(script_to_free):
procedure FreeAnimationScript(scriptToFree: AnimationScript)
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 SplashKit.FreeAnimationScript(string name);
def free_animation_script_with_name(name):
procedure FreeAnimationScript(const name: String)
Has Animation Named
Returns whether an Animation Script
has been loaded with the given name.
Parameters:
Name | Type | Description |
---|---|---|
script | Animation Script | The Animation Script to check. |
name | String | The name of the Animation Script to look for. |
Return Type: Boolean
Signatures:
bool has_animation_named(animation_script script, const string &name)
public static bool SplashKit.HasAnimationNamed(AnimationScript script, string name);
def has_animation_named(script, name):
function HasAnimationNamed(script: AnimationScript; const name: String): Boolean
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.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the animation script to look for. |
Return Type: Boolean
Signatures:
bool has_animation_script(const string &name)
public static bool SplashKit.HasAnimationScript(string name);
def has_animation_script(name):
function HasAnimationScript(const name: String): Boolean
Load Animation Script
Load animation details from an animation frames file.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the Animation Script . |
filename | String | The file to load the Animation Script from. |
Return Type: Animation Script
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);
def load_animation_script(name, filename):
function LoadAnimationScript(const name: String; const filename: String): AnimationScript
Restart Animation
Restart Animation
Restarts an Animation
.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | The Animation to restart. |
Signatures:
void restart_animation(animation anim)
public void Animation.Restart();public static void SplashKit.RestartAnimation(Animation anim);
def restart_animation(anim):
procedure RestartAnimation(anim: Animation)
Restart Animation
Restarts an Animation
. This may play a sound effect if the first frame triggers a sound.
Parameters:
Name | Type | Description |
---|---|---|
anim | Animation | 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.Restart(bool withSound);public static void SplashKit.RestartAnimation(Animation anim, bool withSound);
def restart_animation_with_sound(anim, with_sound):
procedure RestartAnimation(anim: Animation; withSound: Boolean)
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 | Animation | 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 SplashKit.UpdateAnimation(Animation anim, float pct, bool withSound);
def update_animation_percent_with_sound(anim, pct, with_sound):
procedure UpdateAnimation(anim: Animation; pct: Single; withSound: Boolean)
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 | Animation | The Animation to update. |
Signatures:
void update_animation(animation anim)
public void Animation.Update();public static void SplashKit.UpdateAnimation(Animation anim);
def update_animation(anim):
procedure UpdateAnimation(anim: Animation)
Usage:
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 | Animation | 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.Update(float pct);public static void SplashKit.UpdateAnimation(Animation anim, float pct);
def update_animation_percent(anim, pct):
procedure UpdateAnimation(anim: Animation; pct: Single)