1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Smooth Motion: Tweening in Gosu with Ruby

By

1 of 4

Smooth Motion: Tweening in Gosu with Ruby
Smooth Motion: Tweening in Gosu with Ruby

Problem: A sprite must move from point A to point B. The obvious solution is to move the sprite at a constant rate from point A to point B. However, this makes for a rather stiff animation. The sprite will seem to start suddenly and abruptly stop when it gets to point B. One answer to this is called "tweening" and "easing."

Tweening and easing are concepts you might be familiar with if you've done any Flash development. "Tweening" is a technique for providing a number of intermediate steps in a transition. So, for example, our sprite must pass through these intermediate points on its way from A to B. Easing is taking this a step further. Instead of defining evenly spaced points between A and B, it will define points based on a formula. Most formulae in the easing toolbox strive for fluid movement, so the sprite will speed up smoothly, then decelerate as it approaches point B.

  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Rapid Game Prototyping with Gosu
  6. Smooth Motion: Tweening in Gosu with Ruby

©2014 About.com. All rights reserved.