mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-04 07:14:21 +02:00
xss-dimmer: even more easing functions
This commit is contained in:
parent
dc6c2f05ff
commit
7f04bb6cf0
1 changed files with 22 additions and 1 deletions
|
@ -115,9 +115,30 @@ easing_functions = {
|
|||
"ease-out-quint": lambda x: 1 - pow(1 - x, 5),
|
||||
"ease-out-expo": lambda x: 1 - pow(2, -10 * x),
|
||||
"ease-out-quad": lambda x: 1 - (1 - x) * (1 - x),
|
||||
"ease-out-bounce": (
|
||||
lambda n1, d1: lambda x: n1 * x * x
|
||||
if x < 1 / d1
|
||||
else n1 * pow(x - 1.5 / d1, 2) + 0.75
|
||||
if x < 2 / d1
|
||||
else n1 * pow(x - 2.25 / d1, 2) + 0.9375
|
||||
if (x < 2.5 / d1)
|
||||
else n1 * pow(x - 2.625 / d1, 2) + 0.984375
|
||||
)(7.5625, 2.75),
|
||||
"ease-out-elastic": (
|
||||
lambda x: pow(2, -10 * x) * math.sin((x * 10 - 0.75) * (2 * math.pi) / 3) + 1
|
||||
),
|
||||
"ease-inout-quad": lambda x: 2 * x * x if x < 0.5 else 1 - pow(-2 * x + 2, 2) / 2,
|
||||
"ease-inout-quart": (
|
||||
lambda x: 8 * x * x * x * x if x < 0.5 else 1 - pow(-2 * x + 2, 4) / 2
|
||||
),
|
||||
"ease-inout-expo": (
|
||||
lambda x: pow(2, 20 * x - 10) / 2 if x < 0.5 else (2 - pow(2, -20 * x + 10)) / 2
|
||||
),
|
||||
"ease-inout-bounce": (
|
||||
lambda x: (1 - easing_functions["ease-out-bounce"](1 - 2 * x)) / 2
|
||||
if x < 0.5
|
||||
else (1 + easing_functions["ease-out-bounce"](2 * x - 1)) / 2
|
||||
),
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -133,7 +154,7 @@ if __name__ == "__main__":
|
|||
add("--background", help="use a background instead of black")
|
||||
add(
|
||||
"--easing-function",
|
||||
default="ease-out-circ",
|
||||
default="ease-out-bounce",
|
||||
choices=easing_functions.keys(),
|
||||
help="easing function for opacity",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue