In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Using Easing Funcitons

Get Adobe Flash player
by 9re 23 Jun 2009
/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/c9Jw
 */

package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.geom.Point;
    import flash.utils.Timer;
    
    import mx.effects.easing.*;
    import frocessing.color.ColorHSV;
    
    [SWF(frameRate="29")]
    public class EasingFunctionTest extends Sprite {
        private var _bd:BitmapData;
        private var _converter:ColorHSV = new ColorHSV();
        private var _s:int = 465;
        
        public function EasingFunctionTest() {
            
            _bd = new BitmapData(_s, _s, false, 0);
            addChild(new Bitmap(_bd));
            
            stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseHandler);
            mouseHandler(null);
        }
        
        private function mouseHandler(e:MouseEvent):void {
            var i:int, j:int;
            var t:int = (e) ? mouseX * 360 / stage.stageWidth : 60;
            _bd.lock();
            for (i = 0; i < _s; ++i) {
                for(j = 0; j < _s; ++j) {
                    _converter.hsv(Bounce.easeOut(i, t, 360 + t, _s), 1.0,
                                  Bounce.easeOut(j, 1, -1, _s));
                    _bd.setPixel(i, j, _converter.value);
                }
            }
            _bd.unlock();
        }
    }
}