easing-functions

raw JSON →
1.0.4 verified Sat May 09 auth: no python

A collection of basic easing functions for Python, implementing Robert Penner's easing equations. Current version 1.0.4, with infrequent releases and no active maintenance.

pip install easing-functions
error ModuleNotFoundError: No module named 'easing'
cause Trying to import from 'easing' instead of 'easing_functions'.
fix
Use 'from easing_functions import QuadEaseIn'.
error AttributeError: module 'easing_functions' has no attribute 'QuadEaseIn'
cause Trying to access easing class incorrectly, perhaps via 'easing_functions.QuadEaseIn' without importing.
fix
Import explicitly: 'from easing_functions import QuadEaseIn'.
error TypeError: 'QuadEaseIn' object is not callable
cause Forgetting to instantiate the class (e.g., QuadEaseIn instead of QuadEaseIn(...)).
fix
Instantiate: ease = QuadEaseIn(start=0.0, end=1.0, duration=1.0), then call ease(t).
gotcha The instance is callable: ease_instance(t) returns the eased value at time t. t must be between 0 and duration, inclusive.
fix Ensure t in [0, duration].
gotcha All easing classes require start, end, and duration parameters at instantiation.
fix Instantiate as QuadEaseIn(start=0.0, end=10.0, duration=2.0).
gotcha The library provides no easing functions as plain functions; all are callable class instances.
fix Use class instantiation and call the object.

Import an easing class (e.g., QuadEaseIn), instantiate with start, end, and duration, then call the instance with a time value (0 <= t <= duration) to get the eased value.

from easing_functions import QuadEaseIn
ease = QuadEaseIn(start=0.0, end=1.0, duration=1.0)
result = ease(0.5)
print(result)  # Output: 0.25