org.gicentre.utils.move
Class Ease

java.lang.Object
  extended by org.gicentre.utils.move.Ease

public class Ease
extends java.lang.Object

Utility class containing a set of static easing methods. Each takes a value between 0 and 1 and returns a new value also between 0 and 1 representing the 'eased' position. This can be used with lerp() type functions to give a non-linear scaling between the start (0) and end (1) of an interpolated sequence. The most common application will be in animated transitions where animation speed varies between the start and end points.

Version:
3.3, 1st August, 2011.
Author:
Jo Wood, giCentre, City University London, based on the Flash examples discussed by Robert Penner, 2003, Programming Macromedia Flash MX.

Method Summary
static float bounceIn(float t)
          Provides a parabolic bouncing easing in function.
static float bounceIn(float t, float direction)
          Provides a reversible parabolic bouncing easing in function.
static float bounceOut(float t)
          Provides a parabolic bouncing easing out function.
static float bounceOut(float t, float direction)
          Provides a reversible parabolic bouncing easing out function.
static float cubicBoth(float t)
          Provides a cubic easing in and out function.
static float cubicIn(float t)
          Provides a cubic easing in function.
static float cubicIn(float t, float direction)
          Provides a reversible cubic easing in function.
static float cubicOut(float t)
          Provides a cubic easing out function.
static float cubicOut(float t, float direction)
          Provides a reversible cubic easing out function.
static float elasticIn(float t)
          Provides an elastic easing in function simulating a 'pinged' elastic.
static float elasticOut(float t)
          Provides an elastic easing out function simulating an increasingly agitated elastic.
static float quarticBoth(float t)
          Provides a quartic easing in and out function.
static float quarticIn(float t)
          Provides a quartic easing in function.
static float quarticIn(float t, float direction)
          Provides a reversible quartic easing in function.
static float quarticOut(float t)
          Provides a quartic easing out function.
static float quarticOut(float t, float direction)
          Provides a reversible quartic easing out function.
static float quinticBoth(float t)
          Provides a quintic easing in and out function.
static float quinticIn(float t)
          Provides a quintic easing in function.
static float quinticIn(float t, float direction)
          Provides a reversible quintic easing in function.
static float quinticOut(float t)
          Provides a quintic easing out function.
static float quinticOut(float t, float direction)
          Provides a reversible quintic easing out function.
static float sinBoth(float t)
          Provides a sinusoidal easing in and out function.
static float sinIn(float t)
          Provides a sinusoidal easing in function.
static float sinIn(float t, float direction)
          Provides a reversible sinusoidal easing in function.
static float sinOut(float t)
          Provides a sinusoidal easing out function.
static float sinOut(float t, float direction)
          Provides a reversible sinusoidal easing out function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sinIn

public static float sinIn(float t)
Provides a sinusoidal easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

sinIn

public static float sinIn(float t,
                          float direction)
Provides a reversible sinusoidal easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

sinOut

public static float sinOut(float t)
Provides a sinusoidal easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

sinOut

public static float sinOut(float t,
                           float direction)
Provides a reversible sinusoidal easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

sinBoth

public static float sinBoth(float t)
Provides a sinusoidal easing in and out function. Value starts slowly at t=0, accelerates towards t=0.5 and then decelerates towards t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

cubicIn

public static float cubicIn(float t)
Provides a cubic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

cubicIn

public static float cubicIn(float t,
                            float direction)
Provides a reversible cubic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

cubicOut

public static float cubicOut(float t)
Provides a cubic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

cubicOut

public static float cubicOut(float t,
                             float direction)
Provides a reversible cubic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

cubicBoth

public static float cubicBoth(float t)
Provides a cubic easing in and out function. Value starts slowly at t=0, accelerates towards t=0.5 and then decelerates towards t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quarticIn

public static float quarticIn(float t)
Provides a quartic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quarticIn

public static float quarticIn(float t,
                              float direction)
Provides a reversible quartic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

quarticOut

public static float quarticOut(float t)
Provides a quartic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quarticOut

public static float quarticOut(float t,
                               float direction)
Provides a reversible quartic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

quarticBoth

public static float quarticBoth(float t)
Provides a quartic easing in and out function. Value starts slowly at t=0, accelerates towards t=0.5 and then decelerates towards t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quinticIn

public static float quinticIn(float t)
Provides a quintic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quinticIn

public static float quinticIn(float t,
                              float direction)
Provides a reversible quintic easing in function. Value starts slowly at t=0 and accelerates to a maximum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

quinticOut

public static float quinticOut(float t)
Provides a quintic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

quinticOut

public static float quinticOut(float t,
                               float direction)
Provides a reversible quintic easing out function. Value starts rapidly at t=0 and decelerates to a minimum value at t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

quinticBoth

public static float quinticBoth(float t)
Provides a quintic easing in and out function. Value starts slowly at t=0, accelerates towards t=0.5 and then decelerates towards t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

bounceIn

public static float bounceIn(float t)
Provides a parabolic bouncing easing in function. From t=0 value starts with a small 'bounce' that gets larger towards t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

bounceIn

public static float bounceIn(float t,
                             float direction)
Provides a reversible parabolic bouncing easing in function. From t=0 value starts with a small 'bounce' that gets larger towards t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

bounceOut

public static float bounceOut(float t)
Provides a parabolic bouncing easing out function. From t=0 value starts with an accelerating motion until destination reached then it bounces back in increasingly small bounces finally settling at 1 when t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

bounceOut

public static float bounceOut(float t,
                              float direction)
Provides a reversible parabolic bouncing easing out function. From t=0 value starts with an accelerating motion until destination reached then it bounces back in increasingly small bounces finally settling at 1 when t=1. If the direction parameter is negative, the direction of the function is reversed. This can be useful for oscillating animations.

Parameters:
t - Time value between 0-1.
direction - Direction of easing, forward if non-negative, or reverse if negative.
Returns:
Eased value at the given time step.

elasticIn

public static float elasticIn(float t)
Provides an elastic easing in function simulating a 'pinged' elastic. From t=0 value starts with a large perturbation damping down towards a value of 0.5 as t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.

elasticOut

public static float elasticOut(float t)
Provides an elastic easing out function simulating an increasingly agitated elastic. From t=0 value starts at 0.5 with increasingly large perturbations ending at 1 when t=1.

Parameters:
t - Time value between 0-1.
Returns:
Eased value at the given time step.


giCentre Utilities V.3.3, API documentation generated 6th April, 2013