chickadee » sdl2 » rect-lerp-xy

rect-lerp-xy rect1 rect2 tprocedure
rect-lerp-xy! rect1 rect2 t #!optional destprocedure

Efficient linear interpolation (or extrapolation) between rect1 and rect2. sdl2:rect can only hold integer values, so the results will be truncated to integers. The results will be clamped to the range -2147483648 to 2147483647.

These procedures only affect the X and Y values of the rect. The result will have the same W and H as rect1. If you want interpolate all values (X, Y, W, and H), use rect-lerp instead.

t is the interpolation factor (a float). Values of t between 0 and 1 will interpolate between rect1 and rect2. Values of t less that 0 will extrapolate beyond rect1 (moving away from rect2). Values greater that 1 will extrapolate beyond rect2 (moving away from rect1).

  • rect-lerp-xy returns a new managed sdl2:rect.
  • rect-lerp-xy! modifies and returns dest. If dest is omitted, rect1 is modified and returned.

These procedures are available in sdl2 egg version 0.2.0 and higher.