If you have some t, going linearly from 0.0 to 1.0, first transform it before passing it to setPosition or whatever move function.
Example for slow in, slow out:
new_t = (1.0 - math.cos(math.pi * t)) * 0.5
bonus for fast in, slow out:
new_t = math.sin(((1.0 - t) ** 2 + 1) * math.pi / 2.0) ** 2
these new_t values will lie between 0.0 and 1.0 as well.
|