Margrete RPC
Utilities

Easing Functions

Mental model

Easings describe how a value changes from 0 to 1 over a time range. The Python API uses them to calculate curved things.

Some functions accept an easing parameter. You can pass the name of a built-in easing directly:

from margrete_rpc.chart.util import Curve

slide = Curve(...).to(..., ease_x="in_out_sine")
FamilyNames
Linearlinear
Sinein_sine, out_sine, in_out_sine
Quadin_quad, out_quad, in_out_quad
Cubicin_cubic, out_cubic, in_out_cubic
Quartin_quart, out_quart, in_out_quart
Quintin_quint, out_quint, in_out_quint
Expoin_expo, out_expo, in_out_expo
Circin_circ, out_circ, in_out_circ

Custom easings

Anywhere an easing name is accepted, you can also pass a function that maps 0..1 to 0..1.

import math
from margrete_rpc.chart.util import Curve

def stepped_4(t: float) -> float:
    return math.floor(t * 4) / 4 if t < 1 else 1.0

curve = Curve(...).to(..., ease_x=stepped_4)

Custom easings should usually return 0 at input 0 and 1 at input 1. This keeps generated curves landing exactly on their start and end points.

On this page