Close Date Expand Location Next Open/Close Previous 0.5 of 5 stars 1 of 5 stars 1.5 of 5 stars 2 of 5 stars 2.5 of 5 stars 3 of 5 stars 3.5 of 5 stars 4 of 5 stars 4.5 of 5 stars 5 of 5 stars Repeat Slide Current slide

Audrey Sitnik

Creator archive / 1 post

Python easing functions

For precise programmatic animation

Example usage:

duration = 30
for frame in range(duration):
    return ease_in_out_quad(frame/duration)
linear
def linear(t):
    return t
ease_in_sine
def ease_in_sine(t):
    import math
    return -math.cos(t * math.pi / 2) + 1
ease_out_sine
def ease_out_sine(t):
    import math
    return math.sin(t * math.pi / 2)
ease_in_out_sine
def ease_in_out_sine(t):
    import math
    return -(math.cos(math.pi * t) - 1) / 2
ease_in_quad
def ease_in_quad(t):
    return t * t
ease_out_quad
def ease_out_quad(t):
    return -t * (t - 2)
ease_in_out_quad
def ease_in_out_quad(t):
    t *= 2
    if t < 1:
        return t * t / 2
    else:
        t … See more →
Go to this post