Difference between revisions of "SetAnimSize (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
|||
Line 22: | Line 22: | ||
== Main Script == | == Main Script == | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
function setAnimSize(anim, val, duration, easing) | function setAnimSize(anim, val, duration, easing) | ||
duration = duration or 0 -- fallback in case duration equals nil | duration = duration or 0 -- fallback in case duration equals nil |
Latest 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. |