package org.as3lib.kitchensync.easing { /** *

lib_flex_animation_code_10_org_as3lib_kitchensync_easing_Random produces random values between 0.0 and 1.0. Since there is no accelleration, there is only one * ease() function.

*

The easing classes provide static methods for interpolating the change between two values over time. * Each class handles the interpolation, or easing, differently. Each class typically contains three methods * - easeIn(), easeOut() and easeInOut() - which vary the rate of change * of the values. Most of the easing functions produce values as a percentage - a number between 0.0 and 1.0

* * @author Mims H. Wright */ public class lib_flex_animation_code_10_org_as3lib_kitchensync_easing_Random { /** * If set to true, random will snap to 1.0 if duration has elapsed. */ public static var snapping:Boolean = true; /** * Produces a random value between 0.0 and 1.0. If snapping is set to true, * always returns 1.0 when duration has elapsed. * * @param timeElapsed The time since the tween began in milliseconds or frames. * @param duration The duration of the tween, in milliseconds or frames. * @param minimum The lowest value to generate * @param maximum The highest value to generate * @return percentage complete - between 0.0 and 1.0 */ public static function ease(timeElapsed:Number, duration:Number, minimum:Number = 0.0, maximum:Number = 1.0):Number{ if (timeElapsed >= duration && snapping == true) { return 1; } return Math.random() * (maximum + minimum) - minimum; } } }