My favorites | Sign in
Logo
                
Search
for
Updated May 02, 2008 by mimshwright
Easing  
Functions used to interpolate motion between two points.

Easing functions

Easing functions are mathematical functions that are used to interpolate values between two endpoints usually with non-linear results. That's a fancy way of saying that they determine the way something moves.

All of the easing functions in KitchenSync take at least two arguments, time elapsed and duration (some also take additional modifier arguments such as frequency or aplitude), and produce results in the range of 0.0 to 1.0 (again, some functions, such as the Elastics may travel outside of that range). This is slightly different from many other versions of easing functions which calculate a start value and end value but I found this to be cleaner and more versatile.

All of the easing functions are stored as static functions in the org.as3lib.kitchensync.easing package. Since you're using KitchenSync, it's not likely that you will be working with the gritty details of easing functions since they're handled automatically within the KSTween class. However, if you need to access them directly, call the function with the EasingUtil.call() method (more on EasingUtil below), or use the following syntax.

newPosition = startPosition + (Cubic.easeIn(timeElapsed, totalDuration) * (endPosition - startPosition));

Many of the easing functions in KitchenSync have been adapted from Robert Penner's library and are subject to the original terms of use.

Demonstration

The best way to understand the easing functions is to play around with them. Check out this easing demo. Easing Demo

EasingUtil

Included in the easing package is a utility class called EasingUtil. This class contains a few methods that make working with easing functions easier. They are...

Hybrid easing functions

Some functions in the easing package combine or modify other easing functions to produce new hybrid easing functions with unique characteristics.

List of easing functions

KitchenSync contains the following easing functions. Most you are probably familiar with but there are some new ones in bold.

Polynomial functions

Other Math functions

Elastic functions

Oscillating functions

Misc. functions

Related Links


Sign in to add a comment
Hosted by Google Code