open-builder icon indicating copy to clipboard operation
open-builder copied to clipboard

Expand GUiDim

Open Zwolf8 opened this issue 6 years ago • 0 comments

Describe your suggestion

Add mathematical operators (eg. GuiDim.new(10, 0, 0, 0) + GuiDim.new(5, 0, 0, 0)) Add liner interpolation (lerp) (eg. myDim:Lerp(otherDim), 0.1) would allow to smoothly move between two points with a gui. Add tostring support when using tostring(myDim) (also applies to print(myDim) it will print the coordinates. Useful for debugging.

Implementations ideas [optional]

Mathematical operators and tostring can be done through metatables.

  • (__add)
  • (__sub)
  • (__mul) / (__div) % (__mod) ^ (__pow)

tostring/print = (__tostring)

Lerp impl: float lerp(float a, float b, float t) { return a + (b - a) * t; }

see here for sol metatable documentation.

Zwolf8 avatar Feb 19 '20 01:02 Zwolf8