Skip to content

Eases


gaia/lib/tween/easing source


You should note that eases from other libraries will not work with gaia-tween, as they are almost universally defined in the style first defined by Penner. Penner’s equations took start, end, duration, and current time as parameters. Gaia-tween attempts to separate responsibilities so that the ease equation takes only the linear proportion and transforms it.

This has some advantages: gaia-tween has all the eases you would find in other tween libraries, but makes it easier than ever to make your own custom eases. An ease method must follow this pattern:

public function ease(p:Number):Number
{
	return /* some manipulation of */ p;
}

The requirements are that the ease method takes as an input p in the range {p:0 <= p <= 1} and returns values between 0 and 1. It is expected that all ease(0) == 0 and ease(1) == 1.