ESO Lua File v100015

libraries/utility/zo_easing.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function ZO_LinearEase(progress)
    return progress
end
local function EaseIn(progress, power)
    return progress ^ power
end
local function EaseOut(progress, power)
    return 1 - ((1 - progress) ^ power)
end
local function EaseOutIn(progress, power)
    if progress < .5 then
        return ((progress * 2) ^ power) / 2
    end
    return 1 - (((1 - progress) * 2) ^ power) / 2
end
function ZO_EaseInQuadratic(progress)
    return EaseIn(progress, 2)
end
function ZO_EaseOutQuadratic(progress)
    return EaseOut(progress, 2)
end
function ZO_EaseInOutQuadratic(progress)
    return EaseOutIn(progress, 2)
end
function ZO_EaseInCubic(progress)
    return EaseIn(progress, 3)
end
function ZO_EaseOutCubic(progress)
    return EaseOut(progress, 3)
end
function ZO_EaseInOutCubic(progress)
    return EaseOutIn(progress, 3)
end
function ZO_EaseInQuartic(progress)
    return EaseIn(progress, 4)
end
function ZO_EaseOutQuartic(progress)
    return EaseOut(progress, 4)
end
function ZO_EaseInOutQuartic(progress)
    return EaseOutIn(progress, 4)
end
function ZO_EaseInQuintic(progress)
    return EaseIn(progress, 5)
end
function ZO_EaseOutQuintic(progress)
    return EaseOut(progress, 5)
end
function ZO_EaseInOutQuintic(progress)
    return EaseOutIn(progress, 5)
end
function ZO_GenerateCubicBezierEase(x1, y1, x2, y2)
    if x1 == y1 and x2 == y2 then
        return ZO_LinearEase
    end
    return function(progress)
        return CalculateCubicBezierEase(progress, x1, y1, x2, y2)
    end
end