1////////////////////////////////////////////////////////////////////////////////
2//
3//  ADOBE SYSTEMS INCORPORATED
4//  Copyright 2004-2007 Adobe Systems Incorporated
5//  All Rights Reserved.
6//
7//  NOTICE: Adobe permits you to use, modify, and distribute this file
8//  in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11
12package mx.effects.easing
13{
14
15/**
16 *  The Quartic class defines three easing functions to implement
17 *  motion with Flex effect classes. The acceleration of motion for a Quartic easing
18 *  equation is greater than for a Quadratic or Cubic easing equation.
19 *
20 *  For more information, see http://www.robertpenner.com/profmx.
21 */
22public class Quartic
23{
24	include "../../core/Version.as";
25
26	//--------------------------------------------------------------------------
27	//
28	//  Class methods
29	//
30	//--------------------------------------------------------------------------
31
32    /**
33     *  The <code>easeIn()</code> method starts motion from a zero velocity,
34     *  and then accelerates motion as it executes.
35     *
36     *  @param t Specifies time.
37	 *
38     *  @param b Specifies the initial position of a component.
39	 *
40     *  @param c Specifies the total change in position of the component.
41	 *
42     *  @param d Specifies the duration of the effect, in milliseconds.
43     *
44     *  @return Number corresponding to the position of the component.
45     */
46	public static function easeIn(t:Number, b:Number,
47								  c:Number, d:Number):Number
48	{
49		return c * (t /= d) * t * t * t + b;
50	}
51
52    /**
53     *  The <code>easeOut()</code> method starts motion fast,
54     *  and then decelerates motion to a zero velocity.
55     *
56     *  @param t Specifies time.
57	 *
58     *  @param b Specifies the initial position of a component.
59	 *
60     *  @param c Specifies the total change in position of the component.
61	 *
62     *  @param d Specifies the duration of the effect, in milliseconds.
63     *
64     *  @return Number corresponding to the position of the component.
65     */
66	public static function easeOut(t:Number, b:Number,
67								   c:Number, d:Number):Number
68	{
69		return -c * ((t = t / d - 1) * t * t * t - 1) + b;
70	}
71
72    /**
73     *  The <code>easeInOut()</code> method combines the motion
74     *  of the <code>easeIn()</code> and <code>easeOut()</code> methods
75	 *  to start the motion from a zero velocity, accelerate motion,
76	 *  then decelerate to a zero velocity.
77     *
78     *  @param t Specifies time.
79	 *
80     *  @param b Specifies the initial position of a component.
81	 *
82     *  @param c Specifies the total change in position of the component.
83	 *
84     *  @param d Specifies the duration of the effect, in milliseconds.
85     *
86     *  @return Number corresponding to the position of the component.
87     */
88	public static function easeInOut(t:Number, b:Number,
89									 c:Number, d:Number):Number
90	{
91		if ((t /= d / 2) < 1)
92			return c / 2 * t * t * t * t + b;
93
94		return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
95	}
96}
97
98}
99