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

Compare Tween24 Test (use Tweener)

end : disappear circle shape

Compare : http://wonderfl.net/c/ys6p (use Tween24)
Get Adobe Flash player
by Aquioux 02 Oct 2012
/**
 * Copyright Aquioux ( http://wonderfl.net/user/Aquioux )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/s6cV
 */

// forked from Aquioux's Tween24 Test
package {
    //import aquioux.display.colorUtil.CycleRGB;
    //import aquioux.sketch.Dot;
    import caurina.transitions.Tweener;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    [SWF(width = "465", height = "465", frameRate = "60", backgroundColor = "#FFFFFF")]
    /**
     * Tween24 Test
     * Compare : http://wonderfl.net/c/ys6p (use Tween24)
     * @author Aquioux(Yoshida, Akio)
     */
    public class MainTween24 extends Sprite {
        
        private var list_:Array;
        private var timer_:Timer;
        

        public function MainTween24() {
            list_ = [];
            var angle:Number = 0;
            for (var cntY:int = 0; cntY < 47; cntY++) {
                for (var cntX:int = 0; cntX < 47; cntX++) {
                    var dot:Dot = new Dot(5, CycleRGB.getColor(angle+=0.15));
                    dot.x = cntX * 10 + 2.5;
                    dot.y = cntY * 10 + 2.5;
                    dot.scaleX = dot.scaleY = 0;
                    addChild(dot);
                    list_.push(dot);
                }
            }
            
            timer_ = new Timer(1000, 20);
            timer_.addEventListener(TimerEvent.TIMER, update);
            timer_.addEventListener(TimerEvent.TIMER_COMPLETE, tarminate);
            timer_.start();
        }
        
        private function update(e:TimerEvent):void {
            for each (var item:Dot in list_) {
                var rnd:Number = Math.random();
                Tweener.addTween(item, { scaleX:rnd, scaleY:rnd, time:1 } );
            }
        }
        
        private function tarminate(e:TimerEvent):void {
            timer_.removeEventListener(TimerEvent.TIMER, update);
            for each (var item:Dot in list_) Tweener.addTween(item, { scaleX:0, scaleY:0, time:1 } );

        }
    }
}

//package aquioux.sketch {
    import flash.display.Shape;
    /*public*/ class Dot extends Shape {
        public function Dot(radius:Number = 5, color:uint = 0x000000) {
            graphics.beginFill(color);
            graphics.drawCircle(0, 0, radius);
            graphics.endFill();
        }
    }
//}

//package aquioux.display.colorUtil {
    /**
     * コサインカーブで色相環的な RGB を計算
     * @author Aquioux(YOSHIDA, Akio)
     */
    /*public*/ class CycleRGB {
        /**
         * 32bit カラーのためのアルファ値(0~255)
         */
        static public function get alpha():uint { return _alpha; }
        static public function set alpha(value:uint):void {
            _alpha = (value > 0xFF) ? 0xFF : value;
        }
        private static var _alpha:uint = 0xFF;
    
        private static const PI:Number = Math.PI;        // 円周率
        private static const DEGREE120:Number  = PI * 2 / 3;    // 120度(弧度法形式)
        
        /**
         * 角度に応じた RGB を得る
         * @param    angle    HSV のように角度(度数法)を指定
         * @return    色(0xNNNNNN)
         */
        public static function getColor(angle:Number):uint {
            var radian:Number = angle * PI / 180;
            var r:uint = (Math.cos(radian)             + 1) * 0xFF >> 1;
            var g:uint = (Math.cos(radian + DEGREE120) + 1) * 0xFF >> 1;
            var b:uint = (Math.cos(radian - DEGREE120) + 1) * 0xFF >> 1;
            return r << 16 | g << 8 | b;
        }
       
        /**
         * 角度に応じた RGB を得る(32bit カラー)
         * @param    angle    HSV のように角度(度数法)を指定
         * @return    色(0xNNNNNNNN)
         */
        public static function getColor32(angle:Number):uint {
            return _alpha << 24 | getColor(angle);
        }
    }
//}