def cubic_ease_in_ease_out(t, b, c, d):
    """
    Accelerate until halfway, then decelerate.
    """
    t /= d/2
    if t < 1:
        return c / 2 * t * t * t + b
    t -= 2
    return c/2 * (t * t * t + 2) + b