Difference between revisions of "Sliding Interface MKIII (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{| class="ts" style="width:100%"
 
{| class="ts" style="width:100%"
 
|-
 
|-
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By {{lee_PP}}
+
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By
 
|-
 
|-
| Sliding Interface MKIII || Definition || AFRLme
+
| Sliding Interface MKIII || Definition || [https://www.patreon.com/AFRLme 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''.
 
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 #1: 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.''
 +
|-
 +
| ''Quick note #2: Visionaire Studio supports all of the easing options listed on this [https://www.visionaire-studio.com/luadocs/lua.html#easing page]''.
 +
|}
  
  
== Version One (tables) ==
+
== Version 1: 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.
 
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 ==
+
=== Instructions ===
1. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script... <syntaxhighlight lang="lua">
+
 
 +
1. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...  
 +
<hr>
 +
<syntaxhighlight lang="lua">
 +
--[[
 +
Sliding Interface MKIII [v1] (14/08/2022)
 +
Written by AFRLme [Lee Clarke]
 +
-- + --
 +
email: afrlme@outlook.com
 +
paypal: afrlme@zoho.com
 +
patreon: https://www.patreon.com/AFRLme
 +
portfolio: https://afrl.me
 +
-- + --
 +
This script is donation optional. In game credit is non-negotiable.
 +
You are free to: ¹ use it in your game(s). ² modify the script.
 +
Do not remove - or edit - this comment block.
 +
--]]
 +
 
 
local tInt = {
 
local tInt = {
  
["int_example"] = { In = {x = 390, y = 710}, Out = {x = 390, y = 530}, duration = 1000, eIn = easeQuintOut, eOut = easeBounceOut }
+
["int_example_1"] = { In = {x = 390, y = 710}, Out = {x = 390, y = 530}, dur = 1000, eIn = easeQuintIn, eOut = easeBounceOut },
 +
["int_example_2"] = { In = {x = 390, y = -190}, Out = {x = 390, y = -10}, dur = 1200, eIn = easeQuintIn, eOut = easeQuintOut }
  
 
}
 
}
  
function slideInt(int, dir)
+
function slideInt(int)
 
    
 
    
   if dir and (Interfaces[int].Offset.x == tInt[int].In.x and Interfaces[int].Offset.y == tInt[int].In.y) then -- slide out
+
   if 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)
+
     Interfaces[int]:to(tInt[int].dur, { 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
+
   elseif 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)
+
     Interfaces[int]:to(tInt[int].dur, { Offset = {x = tInt[int].In.x, y = tInt[int].In.y} }, tInt[int].eIn)
 
   end
 
   end
 
    
 
    
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
2a. Now you need to create some tables containing various information that will be used to slide the interface(s) in & out; ''the table '''must''' contain the same name as the target interface''.
+
<hr>
<syntaxhighlight>
+
{| class="ts"
local t = {} -- creates an empty table
+
|-
t["inventory_1"] = {x_in = -350, x_out = -20, y_in = 60, y_out = 60, xo = -50, yo = 0, dir =1, state = false} -- from left
+
| ''Quick note: 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>
 +
2. 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...
 +
<hr>
 +
<syntaxhighlight lang="lua">
 +
slideInt("int_example_1")
 
</syntaxhighlight>
 
</syntaxhighlight>
2b. '''x_in''' is the closed coordinate that your interface is positioned on the x-axis & should be the same as the value set in the interface properties tab of the interface you want to slide.<br/>
 
  
2c. '''x_out''' is the coordinate position the interface will slide to (open) on the x-axis.<br/>
 
  
2d. '''y_in''' is the closed coordinate that your interface is positioned on the y-axis & should be the same as the value set in the interface properties tab of the interface you want to slide.<br/>
+
== Version 2: Function Only ==
  
2e. '''y_out''' is the coordinate position the interface will slide to (open) on the x-axis.<br/>
+
This version requires you to input all required arguments needed for the interface to slide in or out, such as: the name of the interface you want to slide in or out, the default position (in) & the target position (out), a boolean value to determine if the interface should slide in or out, the duration in milliseconds that it should take for the interface to slide in or out, & finally the easing that you want to use. As you can probably tell this version is a lot more complicated as you will probably have to note down the relevant information for each interface you want to slide in or out somewhere.
  
2f. '''xo''' is the amount of pixels to offset the x-axis by (closed position) while mouse wheel mode is active (hide the interface). Set '''0''' to deactivate offset for x-axis. ''The offset should contain a positive or negative value depending on direction value, else it should contain 0.''<br/>
+
=== Instructions ===
  
2g. '''yo''' is the amount of pixels to offset the y-axis by (closed position) while mouse wheel mode is active (hide the interface). Set '''0''' to deactivate offset for y-axis. ''The offset should contain a positive or negative value depending on direction value, else it should contain 0.''<br/>
+
1. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...
 +
<hr>
 +
<syntaxhighlight lang="lua">
 +
--[[
 +
Sliding Interface MKIII [v2] (14/08/2022)
 +
Written by AFRLme [Lee Clarke]
 +
-- + --
 +
email: afrlme@outlook.com
 +
paypal: afrlme@zoho.com
 +
patreon: https://www.patreon.com/AFRLme
 +
portfolio: https://afrl.me
 +
-- + --
 +
This script is donation optional. In game credit is non-negotiable.
 +
You are free to: ¹ use it in your game(s). ² modify the script.
 +
Do not remove - or edit - this comment block.
 +
--]]
  
2h. '''dir''' is the direction in which the interface should slide from. 1 = from left, 2 = from right, 3 = from top, 4 = from bottom.<br/>
+
function slideInt(int, spos, tpos, duration, eIn, eOut)
 
+
 
2i. '''state''' controls whether interface is sliding out, in, or is open or closed; default value should be <span class="red">false</span>.<br/>
+
  if Interfaces[int].Offset.x == spos.x and Interfaces[int].Offset.y == spos.y then -- slide out
 
+
    Interfaces[int]:to(duration, { Offset = {x = tpos.x, y = tpos.y} }, eOut)
3. You need to create a condition somewhere & name it '''mouse_wheel_mode'''. The default value should be set to <span 1class="red">false</span>.<br/>
+
  elseif Interfaces[int].Offset.x == tpos.x and Interfaces[int].Offset.y == tpos.y then -- slide in
 
+
    Interfaces[int]:to(duration, { Offset = {x = spos.x, y = spos.y} }, eIn)
4a. Create a button for your interface, move to bottom of list, set button as '''action area''', set object area around the part that will trigger interface slide out on hover.<br/>
+
  end
 
+
    
4b. Add a mouse enter action (or left click action) to the button mentioned in '''4a'''. Inside of this action you should add an if query...
+
end
 
 
if condition 'mouse_wheel_mode' is false
 
   execute a script > (see code block below this)
 
<syntaxhighlight>
 
openInterface("interface_name", 3000, easeQuintInOut) -- open interface_name over 3 seconds with smooth easing (change easing to whatever you prefer)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
end if
+
<hr>
 
+
2. 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 in or out with & then you would insert a line of code that looks like something along the lines of this...
 
+
<hr>
4c. Inside of the ''properties'' tab for the interface, add this action part to the '''action on leaving''' action...
+
<syntaxhighlight lang="lua">
 
+
slideInt("int_example", {x = 390, y = 710}, {x = 390, y = 530}, 1000, easeQuintIn, easeBounceOut)
if condition 'mouse_wheel_mode' is false
 
  execute a script > (see code block below this)
 
<syntaxhighlight>
 
closeInterface("interface_name", 2000, easeBounceOut) -- close interface_name over 2 seconds with bounce out easing (change easing to whatever you prefer)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
end if
 
 
  
5a. Inside of '''game''' > '''mouse properties''': '''mouse wheel up''' you should add these action parts...
 
  
if condition 'mouse_wheel_mode' is true
+
== Version 3: Raw Script ==
  execute a script > (see code block below this)
 
<syntaxhighlight>
 
openInterface("interface_name", 3000, easeQuintInOut)
 
</syntaxhighlight>
 
end if
 
  
 +
Let's just call this section a bonus. Below, I am going to break down the to() tweening function & show you the syntax, & some examples of how you would use it for sliding an interface in or out, & finally an example of how you can toggle an interface in & out.
  
5b. Inside of '''game''' > '''mouse properties''': '''mouse wheel down''' you should add these action parts...
+
=== Syntax ===
  
if condition 'mouse_wheel_mode' is true
+
<syntaxhighlight lang="lua">
  execute a script > (see code block below this)
+
to(duration, {arguments}, easing, loop, pendulum)
<syntaxhighlight>
 
closeInterface("interface_name", 2000, easeBounceOut)
 
 
</syntaxhighlight>
 
</syntaxhighlight>
end if
 
  
 +
=== Example 1: Slide Out ===
  
6. To toggle mouse wheel mode, you need to create an object in your options menu or a key input command containing...
+
<syntaxhighlight lang="lua">
 +
local int = Interfaces["int_example"]
  
  toggle condition 'mouse_wheel_mode'
+
if int.Offset.y == 710 then
 
+
  int:to(1000, { Offset = {x = int.Offset.x, y = 530} }, easeBounceOut)
 
+
end
7. Inside of your scenes, you should probably add inside of an at begin of scene action, an execute a script action containing...
 
<syntaxhighlight>
 
closeInterface("interface_name", 0, easeNoneInOut) -- instantly resets interface_name back to closed position; just in case the interface was open when you changed scenes.
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Main Script ==
+
=== Example 2: Slide In ===
<syntaxhighlight>
 
--[[
 
Sliding Interface MKII [v3] (27/11/2014)
 
Written by AFRLme [Lee Clarke]
 
-- + --
 
alternatingfrequencies@hotmail.com | skype @ AFRLme
 
-- + --
 
This script is donation optional. In game credit is non-negotiable.
 
You are free to: ¹ use it in your game(s). ² modify the script.
 
Do not remove - or edit - this comment block.
 
--]]
 
  
-- * local variables * --
+
<syntaxhighlight lang="lua">
local p, ox, oy -- empty variables
+
local int = Interfaces["int_example"]
  
-- * local tables * --
+
if int.Offset.y == 530 then
local t = {} -- empty table
+
int:to(1000, { Offset = {x = int.Offset.x, y = 710} }, easeQuintIn)
t["inventory_1"] = {x_in = -350, x_out = -20, y_in = 60, y_out = 60, xo = -50, yo = 0, dir =1, state = false} -- from left
 
t["inventory_2"] = {x_in = 1230, x_out =  930, y_in = 60, y_out = 60, xo = 50, yo = 0, dir = 2, state = false} -- from right
 
t["inventory_3"] = {x_in = 440, x_out = 440, y_in = -550, y_out = -20, xo = 0, yo = -50, dir = 3, state = false} -- from top
 
t["inventory_4"] = {x_in = 440, x_out = 440, y_in = 670, y_out = 140, xo = 0, yo = 50, dir = 4, state = false} -- from bottom
 
 
-- * function that slides the interface out * --
 
function openInterface(int, delay, easing, dir)
 
if t[int]["state"] ~= true then t[int]["state"] = true -- if not already sliding out then begin sliding out (safety measure to make sure it keeps sliding)
 
  if t[int].dir == 1 or t[int].dir == 2 then p = math.floor(( Interfaces[int].InterfaceOffset.x - t[int].x_out) / (t[int].x_in - t[int].x_out) * 100); delay = math.floor((delay / 100) * p ) end
 
  if t[int].dir == 3 or t[int].dir == 4 then p = math.floor(( Interfaces[int].InterfaceOffset.y - t[int].y_out) / (t[int].y_in - t[int].y_out) * 100); delay = math.floor((delay / 100) * p ) end
 
  startObjectTween( Interfaces[int], VInterfaceOffset, Interfaces[int].InterfaceOffset, {x = t[int].x_out, y = t[int].y_out}, delay, easing)
 
end
 
end
 
 
-- * function that slides the interface in * --
 
function closeInterface(int, delay, easing, dir)
 
  t[int]["state"] = false
 
  if Conditions["mouse_wheel_mode"].ConditionValue then ox = t[int].xo; oy = t[int].yo else ox = 0; oy = 0 end
 
  if t[int].dir == 1 or t[int].dir == 2 then p = math.floor(( Interfaces[int].InterfaceOffset.x - t[int].x_in) / (t[int].x_out - t[int].x_in) * 100); delay = math.floor((delay / 100) * p ) end
 
  if t[int].dir == 3 or t[int].dir == 4 then p = math.floor(( Interfaces[int].InterfaceOffset.y - t[int].y_in) / (t[int].y_out - t[int].y_in) * 100); delay = math.floor((delay / 100) * p ) end
 
  startObjectTween( Interfaces[int], VInterfaceOffset, Interfaces[int].InterfaceOffset, {x = t[int].x_in + ox, y = t[int].y_in + oy}, delay, easing)
 
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
=== Example 3: Toggle ===
  
== Alternative Script ==
+
<syntaxhighlight lang="lua">
This script is the same as the above script but uses the old getObject scripting method. ''At least Visionaire Studio 4.0 is required to run this script because of the startObjectTween function.''
+
local int = Interfaces["int_example"]
  
<syntaxhighlight>
+
if int.Offset.y == 710 then
--[[
+
int:to(1000, { Offset = {x = int.Offset.x, y = 530} }, easeBounceOut)
Sliding Interface MKII [v3] (27/11/2014)
+
elseif int.Offset.y == 530 then
Written by AFRLme [Lee Clarke]
+
int:to(1000, { Offset = {x = int.Offset.x, y = 710} }, easeQuintIn)
-- + --
 
alternatingfrequencies@hotmail.com | skype @ AFRLme
 
-- + --
 
This script is donation optional. In game credit is non-negotiable.
 
You are free to: ¹ use it in your game(s). ² modify the script.
 
Do not remove - or edit - this comment block.
 
--]]
 
 
 
-- * local variables * --
 
local p, ox, oy -- empty variables
 
 
 
-- * local tables * --
 
local t = {} -- empty table
 
t["inventory_1"] = {x_in = -350, x_out = -20, y_in = 60, y_out = 60, xo = -50, yo = 0, dir =1, state = false} -- from left
 
t["inventory_2"] = {x_in = 1230, x_out =  930, y_in = 60, y_out = 60, xo = 50, yo = 0, dir = 2, state = false} -- from right
 
t["inventory_3"] = {x_in = 440, x_out = 440, y_in = -550, y_out = -20, xo = 0, yo = -50, dir = 3, state = false} -- from top
 
t["inventory_4"] = {x_in = 440, x_out = 440, y_in = 670, y_out = 140, xo = 0, yo = 50, dir = 4, state = false} -- from bottom
 
 
-- * function that slides the interface out * --
 
function openInterface(int, delay, easing, dir)
 
if t[int]["state"] ~= true then t[int]["state"] = true -- if not already sliding out then begin sliding out (safety measure to make sure it keeps sliding)
 
  if t[int].dir == 1 or t[int].dir == 2 then p = math.floor((getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset).x - t[int].x_out) / (t[int].x_in - t[int].x_out) * 100); delay = math.floor((delay / 100) * p) end
 
  if t[int].dir == 3 or t[int].dir == 4 then p = math.floor((getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset).y - t[int].y_out) / (t[int].y_in - t[int].y_out) * 100); delay = math.floor((delay / 100) * p) end
 
  startObjectTween(getObject("Interfaces[" .. int .. "]"), VInterfaceOffset, getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset), {x = t[int].x_out, y = t[int].y_out}, delay, easing)
 
end
 
end
 
 
-- * function that slides the interface in * --
 
function closeInterface(int, delay, easing, dir)
 
  t[int]["state"] = false
 
  if getObject("Conditions[mouse_wheel_mode]"):getBool(VConditionValue) then ox = t[int].xo; oy = t[int].yo else ox = 0; oy = 0 end
 
  if t[int].dir == 1 or t[int].dir == 2 then p = math.floor((getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset).x - t[int].x_in) / (t[int].x_out - t[int].x_in) * 100); delay = math.floor((delay / 100) * p) end
 
  if t[int].dir == 3 or t[int].dir == 4 then p = math.floor((getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset).y - t[int].y_in) / (t[int].y_out - t[int].y_in) * 100); delay = math.floor((delay / 100) * p) end
 
  startObjectTween(getObject("Interfaces[" .. int .. "]"), VInterfaceOffset, getObject("Interfaces[" .. int .. "]"):getPoint(VInterfaceOffset), {x = t[int].x_in + ox, y = t[int].y_in + oy}, delay, easing)
 
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 199: Line 158:
 
! style="text-align:left" | Name !! style="text-align:left" | Description
 
! style="text-align:left" | Name !! style="text-align:left" | Description
 
|-
 
|-
| [[media:sliding_interface_vs4.zip|sliding_interface_vs4.zip]] || A working example of the script in action. ''Visionaire Studio 4.0.1+'' required to run the included .ved file.
+
| [[media:sliding_interface_mk3.zip|sliding_interface_mk3.zip]] || A working example of the script in action. ''Visionaire Studio 5.1.9.2+'' required to run the included .ved file(s).
 
|}{{toc}}
 
|}{{toc}}

Latest revision as of 12:35, 15 September 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 #1: 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.
Quick note #2: Visionaire Studio supports all of the easing options listed on this page.


Version 1: 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

1. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...


--[[
Sliding Interface MKIII [v1] (14/08/2022)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]

local tInt = {

["int_example_1"] = { In = {x = 390, y = 710}, Out = {x = 390, y = 530}, dur = 1000, eIn = easeQuintIn, eOut = easeBounceOut },
["int_example_2"] = { In = {x = 390, y = -190}, Out = {x = 390, y = -10}, dur = 1200, eIn = easeQuintIn, eOut = easeQuintOut }

}

function slideInt(int)
  
  if 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].dur, { Offset = {x = tInt[int].Out.x, y = tInt[int].Out.y} }, tInt[int].eOut)
  elseif 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].dur, { Offset = {x = tInt[int].In.x, y = tInt[int].In.y} }, tInt[int].eIn)
  end
  
end

Quick note: 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.

2. 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_1")


Version 2: Function Only

This version requires you to input all required arguments needed for the interface to slide in or out, such as: the name of the interface you want to slide in or out, the default position (in) & the target position (out), a boolean value to determine if the interface should slide in or out, the duration in milliseconds that it should take for the interface to slide in or out, & finally the easing that you want to use. As you can probably tell this version is a lot more complicated as you will probably have to note down the relevant information for each interface you want to slide in or out somewhere.

Instructions

1. Add this script into the script section of the Visionaire Studio editor & set as a defintion type script...


--[[
Sliding Interface MKIII [v2] (14/08/2022)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]

function slideInt(int, spos, tpos, duration, eIn, eOut)
  
  if Interfaces[int].Offset.x == spos.x and Interfaces[int].Offset.y == spos.y then -- slide out
    Interfaces[int]:to(duration, { Offset = {x = tpos.x, y = tpos.y} }, eOut)
  elseif Interfaces[int].Offset.x == tpos.x and Interfaces[int].Offset.y == tpos.y then -- slide in
    Interfaces[int]:to(duration, { Offset = {x = spos.x, y = spos.y} }, eIn)
  end
  
end

2. 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 in or out with & then you would insert a line of code that looks like something along the lines of this...


slideInt("int_example", {x = 390, y = 710}, {x = 390, y = 530}, 1000, easeQuintIn, easeBounceOut)


Version 3: Raw Script

Let's just call this section a bonus. Below, I am going to break down the to() tweening function & show you the syntax, & some examples of how you would use it for sliding an interface in or out, & finally an example of how you can toggle an interface in & out.

Syntax

to(duration, {arguments}, easing, loop, pendulum)

Example 1: Slide Out

local int = Interfaces["int_example"]

if int.Offset.y == 710 then
 int:to(1000, { Offset = {x = int.Offset.x, y = 530} }, easeBounceOut)
end

Example 2: Slide In

local int = Interfaces["int_example"]

if int.Offset.y == 530 then
 int:to(1000, { Offset = {x = int.Offset.x, y = 710} }, easeQuintIn)
end

Example 3: Toggle

local int = Interfaces["int_example"]

if int.Offset.y == 710 then
 int:to(1000, { Offset = {x = int.Offset.x, y = 530} }, easeBounceOut)
elseif int.Offset.y == 530 then
 int:to(1000, { Offset = {x = int.Offset.x, y = 710} }, easeQuintIn)
end


Resources

Name Description
sliding_interface_mk3.zip A working example of the script in action. Visionaire Studio 5.1.9.2+ required to run the included .ved file(s).