Difference between revisions of "Sliding Interface MKIII (CMS)"
m |
|||
Line 7: | Line 7: | ||
This script allows you to slide interfaces in/out on mouse over/out, via mouse wheel, via key input, or via an interface button. ''Visionaire Studio 5+ is required to run this script''. | This script allows you to slide interfaces in/out on mouse over/out, via mouse wheel, via key input, or via an interface button. ''Visionaire Studio 5+ is required to run this script''. | ||
− | + | <hr> | |
+ | {| class="ts" | ||
+ | |- | ||
+ | | ''Quick note: The interface will only slide in or out if the interface is fully in or out. You can't interrupt it once you start it sliding. The only way to interrupt it & maintain the correct speed would require math calculations to get the current percentage between the start position & target position, which in this case is more hassle than it's worth.'' | ||
+ | |} | ||
== Version One (tables) == | == Version One (tables) == | ||
Line 31: | Line 35: | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 1b. You need to edit the script above & insert the names of any interfaces you want to be able to slide in & out. You will also need to define the default position of the interfaces [In] & the target position of the interfaces [Out]. Don't forget to include the duration it should take the interface to slide in or out, or the easing you want to use. | |
<hr> | <hr> | ||
{| class="ts" | {| class="ts" | ||
Line 37: | Line 41: | ||
| ''Quick note: Visionaire Studio supports most of the easing options listed on this [https://easings.net page], however in Visionaire Studio easings are written like this: <span class="green">easeQuintInOut</span>, instead of this: <span class="green">easeInOutQuint</span>''. | | ''Quick note: Visionaire Studio supports most of the easing options listed on this [https://easings.net page], however in Visionaire Studio easings are written like this: <span class="green">easeQuintInOut</span>, instead of this: <span class="green">easeInOutQuint</span>''. | ||
|} | |} | ||
+ | |||
+ | 2a. To use this script you need to create an execute a script action part inside of the key actions, mouse enters/leave actions, command actions, etc. that you want to use to slide an interface out with & then you would insert a line of code that looks like something along the lines of this... | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | slideInt("int_example", true) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 2b. To slide the interface back in you would use the same steps as '''2a''', except the script would look like something along the lines of this... | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | slideInt("int_example", false) | ||
+ | </syntaxhighlight> | ||
Revision as of 22:42, 14 August 2022
Name | Type | By |
---|---|---|
Sliding Interface MKIII | Definition | AFRLme |
This script allows you to slide interfaces in/out on mouse over/out, via mouse wheel, via key input, or via an interface button. Visionaire Studio 5+ is required to run this script.
Quick note: The interface will only slide in or out if the interface is fully in or out. You can't interrupt it once you start it sliding. The only way to interrupt it & maintain the correct speed would require math calculations to get the current percentage between the start position & target position, which in this case is more hassle than it's worth. |
Version One (tables)
This version uses Lua tables/arrays for storing the positional, easing, & duration data for each interface you want to slide out. This version is easier to use overall as you don't need to manually specify all of the data each time into the function.
Instructions
1a. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...local tInt = {
["int_example"] = { In = {x = 390, y = 710}, Out = {x = 390, y = 530}, duration = 1000, eIn = easeQuintOut, eOut = easeBounceOut }
}
function slideInt(int, dir)
if dir and (Interfaces[int].Offset.x == tInt[int].In.x and Interfaces[int].Offset.y == tInt[int].In.y) then -- slide out
Interfaces[int]:to(tInt[int].duration, { Offset = {x = tInt[int].Out.x, y = tInt[int].Out.y} }, tInt[int].eOut)
elseif not dir and (Interfaces[int].Offset.x == tInt[int].Out.x and Interfaces[int].Offset.y == tInt[int].Out.y) then -- slide in
Interfaces[int]:to(tInt[int].duration, { Offset = {x = tInt[int].In.x, y = tInt[int].In.y} }, tInt[int].eIn)
end
end
1b. You need to edit the script above & insert the names of any interfaces you want to be able to slide in & out. You will also need to define the default position of the interfaces [In] & the target position of the interfaces [Out]. Don't forget to include the duration it should take the interface to slide in or out, or the easing you want to use.
Quick note: Visionaire Studio supports most of the easing options listed on this page, however in Visionaire Studio easings are written like this: easeQuintInOut, instead of this: easeInOutQuint. |
2a. To use this script you need to create an execute a script action part inside of the key actions, mouse enters/leave actions, command actions, etc. that you want to use to slide an interface out with & then you would insert a line of code that looks like something along the lines of this...
slideInt("int_example", true)
2b. To slide the interface back in you would use the same steps as 2a, except the script would look like something along the lines of this...
slideInt("int_example", false)
Resources
Name | Description |
---|---|
sliding_interface_vs4.zip | A working example of the script in action. Visionaire Studio 4.0.1+ required to run the included .ved file. |