📄 linear.as
字号:
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2005 Macromedia, Inc. All Rights Reserved.
// The following is Sample Code and is subject to all restrictions
// on such code as contained in the End User License Agreement
// accompanying this product.
//
////////////////////////////////////////////////////////////////////////////////
package com.robertpenner.easing
{
/**
* The Linear class defines easing functions to implement
* linear motion with Flex effect classes.
*
* For more information, see http://www.robertpenner.com/profmx.
*/
public class Linear
{
//--------------------------------------------------------------------------
//
// Class methods
//
//--------------------------------------------------------------------------
/**
* The <code>easeNone()</code> method defines a constant motion,
* with no acceleration.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*/
public static function easeNone(t:Number, b:Number,
c:Number, d:Number):Number
{
return c * t / d + b;
}
/**
* The <code>easeIn()</code> method starts motion from zero velocity,
* and then accelerates motion as it executes.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*/
public static function easeIn(t:Number, b:Number,
c:Number, d:Number):Number
{
return c * t / d + b;
}
/**
* The <code>easeOut()</code> method starts motion fast,
* and then decelerates motion to a zero velocity as it executes.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*/
public static function easeOut(t:Number, b:Number,
c:Number, d:Number):Number
{
return c * t / d + b;
}
/**
* The <code>easeInOut()</code> method combines the motion
* of the <code>easeIn()</code> and <code>easeOut()</code> methods
* to start the motion from zero velocity, accelerate motion,
* then decelerate back to zero velocity.
*
* @param t Specifies time.
*
* @param b Specifies the initial position of a component.
*
* @param c Specifies the total change in position of the component.
*
* @param d Specifies the duration of the effect, in milliseconds.
*
* @return Number corresponding to the position of the component.
*/
public static function easeInOut(t:Number, b:Number,
c:Number, d:Number):Number
{
return c * t / d + b;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -