ObjVisibility (CMS)
From The Official Visionaire Studio: Adventure Game Engine Wiki
Name | Type | By |
---|---|---|
objVisibility({t}, val, duration, easing) | Definition | AFRLme |
This small function allows you to quickly adjust the visibility of multiple scene objects, which can be useful for setting up scenes without having to create tons of set visibility action parts.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. Usage example #1: immediately update the visibility of all listed scene objects to 0
objVisibility({"obj1", "obj2", "obj3"}, 0)
2b. Usage example #3: update the visibility of all listed scene objects in the linked table to 50% over 250ms with easeQuadOut easing
local tbl = {"obj1", "obj2", "obj3"}
objVisibility(tbl, 50, 250, easeQuadOut)
Main Script
function objVisibility(t, val, duration, easing)
duration = duration or 0 -- fallback in case duration equals nil or empty
easing = easing or easeLinearInOut -- fallback in case duration equals nil or emptyObject
-- + --
for i = 1, #t do -- iterate through the tables
game.CurrentScene.Objects[ t[i] ]:to(duration, {Visibility = val}, easing) -- update visibility of currently listed scene object
end
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
t | table | This should be a table or linked table containing the "names" of the scene objects that you want to update visibility (opacity) value of. |
val | integer | This should contain a number value between 0 & 100, with zero being invisible & 100 being fully visible. |
duration | integer | This should contain a number value in milliseconds of how long you want the visibility 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. |