Difference between revisions of "SetAnimSize (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (Text replacement - "wikitable" to "ts") |
|||
Line 3: | Line 3: | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ||
|- | |- | ||
− | | setAnimSize(" | + | | setAnimSize("anim", val, duration, easing) || Definition || AFRLme |
|} | |} | ||
− | This small function allows you to quickly set the size( | + | This small function allows you to quickly set the size (percent) immediately of an active animation; or over x time with optional easing. |
+ | |||
== Instructions == | == Instructions == | ||
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/> | 1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/> | ||
− | + | 2a. Usage Example #1: update animation size immediately from current size to 10% | |
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
− | setAnimSize("animation_name", | + | setAnimSize("animation_name", 10) |
+ | </syntaxhighlight> | ||
+ | 2b. Usage Example #2: update animation size over 2000ms from current size to 10% with easeQuintIn easing. | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | setAnimSize("animation_name", 10, 2000, easeQuintIn) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
== Main Script == | == Main Script == | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | function setAnimSize( | + | function setAnimSize(anim, val, duration, easing) |
− | + | duration = duration or 0 -- fallback in case duration equals nil | |
+ | easing = easing or easeLinearInOut -- fallback in case easing equals nil | ||
+ | -- + -- | ||
+ | ActiveAnimations[anim]:to(duration, {Size = val}, easing) -- update animation size | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
== Syntax Breakdown == | == Syntax Breakdown == | ||
Line 27: | Line 37: | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description | ||
|- | |- | ||
− | | | + | | anim || "string" || This should be a "string" value containing the name of the animation you want to affect. |
+ | |- | ||
+ | | val || integer || This should be a number value which will used to determine size (percentage) of the linked animation (anim). | ||
+ | |- | ||
+ | | duration || integer || This should contain a number value in milliseconds of how long you want the animation size to take to change from the current value to the target value. | ||
|- | |- | ||
− | | | + | | easing || integer || This should contain a number value, or the variable name of the easing type that you want to use. Here is a list of available [https://www.visionaire-studio.com/luadocs/lua.html#easing easing options]. |
− | |} | + | |}{{toc}} |
Revision as of 17:47, 23 August 2022
Name | Type | By |
---|---|---|
setAnimSize("anim", val, duration, easing) | Definition | AFRLme |
This small function allows you to quickly set the size (percent) immediately of an active animation; or over x time with optional easing.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. Usage Example #1: update animation size immediately from current size to 10%
setAnimSize("animation_name", 10)
2b. Usage Example #2: update animation size over 2000ms from current size to 10% with easeQuintIn easing.
setAnimSize("animation_name", 10, 2000, easeQuintIn)
Main Script
function setAnimSize(anim, val, duration, easing)
duration = duration or 0 -- fallback in case duration equals nil
easing = easing or easeLinearInOut -- fallback in case easing equals nil
-- + --
ActiveAnimations[anim]:to(duration, {Size = val}, easing) -- update animation size
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
anim | "string" | This should be a "string" value containing the name of the animation you want to affect. |
val | integer | This should be a number value which will used to determine size (percentage) of the linked animation (anim). |
duration | integer | This should contain a number value in milliseconds of how long you want the animation size to take to change from the current value to the target value. |
easing | integer | This should contain a number value, or the variable name of the easing type that you want to use. Here is a list of available easing options. |