gillcup.easing

The easing module defines a number of functions usable in gillcup.Animation.

The functions are partly based on Robert Penner’s Motion, Tweening, and Easing, and on Qt’s QEasingCurve. See their pages for more background.

Each of the functions defined here can be used directly for an “ease in” animation (one that speeds up over time). For other types, use attributes: out (slows down over time), in_out (speeds up, then slows down), and out_in (slows down, then speeds up). The ease-in is also available in in_. For example, gillcup.easing.quadratic.in_out is a nice natural-looking tween.

Polynomial easing functions

gillcup.easing.linear(t)[source]

Linear interpolation

t → t

gillcup.easing.quadratic(t)[source]

Quadratic easing

t → t**2

gillcup.easing.cubic(t)[source]

Cubic easing

t → t**3

gillcup.easing.quartic(t)[source]

Quartic easing

t → t**4

gillcup.easing.quintic(t)[source]

Quintic easing

t → t**5

Other simple easing functions

gillcup.easing.sine(t)[source]

Sinusoidal easing

Quarter of a cosine wave

gillcup.easing.exponential(t)[source]

Exponential easing

gillcup.easing.circular(t)[source]

Circular easing

Easing factories

gillcup.easing.elastic(period, amplitude=1)[source]

Elastic easing factory

gillcup.easing.overshoot(amount)[source]

Overshoot easing factory

gillcup.easing.bounce(amplitude)[source]

Bounce easing factory

Helpers for creating new easing functions

gillcup.easing.easefunc(func)[source]

Decorator for easing functions.

Adds the in_, out, in_out and out_in attributes to an easing function.

gillcup.easing.normalized(func)[source]

Decorator that normalizes an easing function

Normalizing is done so that func(0) == 0 and func(1) == 1.

Graph

For some visual reference, here are the graphs of the various functions in this module.

../_images/easings.png

The graph can be generated by running this module directly (i.e. by python -m gillcup.easing). If a command-line argument is given, the graph will be saved to the given file, otherwise it will be displayed. You’ll need to install matplotlib to create the graph.