Derma_Anim problems

Every time i use derma anim and try to change the easing, It will always be EaseInQuad. I tried EaseOutQuad, EaseOutElastic but they are just not working. Can anyone give me a good explanation of Derma_Anim?

[lua]

// ----
// Make some random panel or whatever

local my_panel = vgui.Create( “DFrame” )
my_panel:SetTitle( “Derma_Anim Example” )
my_panel:SetSize( 250, 200 )
my_panel:SetPos( 200 )
my_panel:MakePopup()

// ----
// define the animation function, which, when called, should actually do the “animation”, move position
// bounce around the screen or whatever, heck, you could use cam.3d2d and make it bounce around the world
// if you Really wanted to

local function panelAnimFunction( my_panel_now_animated, derma_anim_object, anim_percent_completed )
my_panel_now_animated:SetPos( Lerp( anim_percent_completed, 200,800 ), 300 )

if( not derma_anim_object:Active() ) then
	derma_anim_object:Start( 20 ) -- re-animate me for 20 seconds
end

end

// ----
// make derma_anim object

local animate_my_panel = Derma_Anim( “Sometimes i dream about cheese”, my_panel, panelAnimFunction )
animate_my_panel:Start( 10 ) – tell the animation it takes 10 seconds to reach 100%

// ----
// :Run() needs to be called every frame
//
// but i’m going to do this instead, because i can

timer.Create( “slowly animate my panel”, 0.5, 0, function()
if( animate_my_panel:Active() ) then
animate_my_panel:Run() – I like to move it, move it!
end
end )[/lua]

This works, but I’m looking for a way to make easeOutElastic possible in GMod.

You need the math for it.

Managed to find this

relevant snippet:
[lua]

– For all easing functions:
– t = elapsed time
– b = begin
– c = change == ending - beginning
– d = duration (total time)

local pow = math.pow
local sin = math.sin
local cos = math.cos
local pi = math.pi
local sqrt = math.sqrt
local abs = math.abs
local asin = math.asin

– a: amplitud
– p: period
local function outElastic(t, b, c, d, a, p)
if t == 0 then return b end

t = t / d

if t == 1 then return b + c end

if not p then p = d * 0.3 end

local s

if not a or a < abs© then
a = c
s = p / 4
else
s = p / (2 * pi) * asin(c/a)
end

return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b
end
[/lua]

And what does the


(t, b, c, d, a, p)

stand for?

Those are pretty much dummy variables that are used to pass the arguments from the function. You might want to look at some lua tutorials.

nvm i just realized they are added in the comments…