fast quadratic exit feels better

This commit is contained in:
Kistaro Windrider 2024-12-26 17:05:55 -08:00
parent caaf848722
commit cbdf2a27cd
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -156,14 +156,14 @@ end
-- rearm pane objects -- rearm pane objects
easing_pane = mknew{ easing_pane = mknew{
-- to enter: pos = -1; to exit: pos = 1 -- to enter: pos = -1; to exit: pos = 1
-- runs for 16 frames -- runs for 16 frames in, 8 frames out
} }
function easing_pane:frac() function easing_pane:frac()
local pos = self.pos local pos = self.pos
if (not pos) return if (not pos) return
if (pos < 0) return 1-easeoutbounce(1+pos) if (pos < 0) return 1-easeoutbounce(1+pos)
if (pos > 0) return easeoutbounce(1-pos) if (pos > 0) return (1-pos)*(1-pos)
return 0 return 0
end end
@ -173,7 +173,7 @@ function easing_pane:update()
-- increment is 0x0.1 -- 1/16th of pos -- increment is 0x0.1 -- 1/16th of pos
if (pos < 0) pos = min(pos + 0x0.1, 0) if (pos < 0) pos = min(pos + 0x0.1, 0)
if pos > 0 then if pos > 0 then
pos -= 0x0.1 pos -= 0x0.2
if (pos <= 0) pos = nil if (pos <= 0) pos = nil
end end
self.pos = pos self.pos = pos