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

Sean Yen

Creator archive / 1 post

Python easing functions

For precise programmatic animation

Example usage:

duration = 30
for frame in range(duration):
    return easeInOutQuad(frame/duration)
linear
def linear(t):
    return t
easeInSine
def easeInSine(t):
    import math
    return -math.cos(t * math.pi / 2) + 1
easeOutSine
def easeOutSine(t):
    import math
    return math.sin(t * math.pi / 2)
easeInOutSine
def easeInOutSine(t):
    import math
    return -(math.cos(math.pi * t) - 1) / 2
easeInQuad
def easeInQuad(t):
    return t * t
easeOutQuad
def easeOutQuad(t):
    return -t * (t - 2)
easeInOutQuad
def easeInOutQuad(t):
    t *= 2
    if t < 1:
        return t * t / 2
    else:
        t … See more →
Go to this post