easings — Easing effects for transitions

Easing reference

class easings.Easing

Enum type used for referencing easing types to work with transitions. Read more about Transitions here. It has the following values:

  • Easing.none - default easing, representing a linear progress

  • Easing.back_in

  • Easing.back_in_out

  • Easing.back_out

  • Easing.bounce_in

  • Easing.bounce_in_out

  • Easing.bounce_out

  • Easing.circular_in

  • Easing.circular_in_out

  • Easing.circular_out

  • Easing.cubic_in

  • Easing.cubic_in_out

  • Easing.cubic_out

  • Easing.elastic_in

  • Easing.elastic_in_out

  • Easing.elastic_out

  • Easing.exponential_in

  • Easing.exponential_in_out

  • Easing.exponential_out

  • Easing.quadratic_in

  • Easing.quadratic_in_out

  • Easing.quadratic_out

  • Easing.quartic_in

  • Easing.quartic_in_out

  • Easing.quartic_out

  • Easing.quintic_in

  • Easing.quintic_in_out

  • Easing.quintic_out

  • Easing.sine_in

  • Easing.sine_in_out

  • Easing.sine_out

../_images/easings.png

ease() reference

easings.ease(easing, t)

Calculates the rate of change at time t for specific easing. The t parameter should be a float with a value between 0 (start of transition) and 1 (end of transition). The easing must be an easings.Easing value.

Returned value is a float.

print("Half into transition time, the rate value with the default easing is {}".format(ease(Easing.none, 0.5)))
print("Half into transition time, the rate value with exponential easing is {}".format(ease(Easing.exponential_in, 0.5)))

ease_between() reference

easings.ease_between(easing, t, a, b)

Calculates the actual value transitioning from a to b at time t using given easing.

The a and b parameters must be either floats of vectors (geometry.Vector).

The t must be a float between 0 (start of transition) and 1 (end of transition)

The easing must be an easings.Easing value.

a = 50
b = 100
t = 0.5
easing = Easing.none
result = ease_between(a, b, t, easing)
print('At time t={}, the value transitioning from a={} to b={} with easing {} will be {}'.format(t, a, b, str(easing), result))
#  At time t=0.5, the value transitioning from a=50.0 to b=100.0 with easing Easing.none will be 75.0