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

Tween24 Test

end : disappear circle shape

Compare : http://wonderfl.net/c/s6cV (use Tweener)
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/ys6p
 */

package {
    import a24.tween.Tween24;
    //import aquioux.display.colorUtil.CycleRGB;
    //import aquioux.sketch.Dot;
    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/s6cV (use Tweener)
     * @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;
                    list_.push(dot);
                }
            }
            Tween24.addChild(this, list_).play();
            Tween24.prop(list_).scale(0).play();
            
            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_) Tween24.tween(item, 1).scale(Math.random()).play();
            //Tween24.tween(list_, 1).scale(Math.random()).play();
        }
        
        private function tarminate(e:TimerEvent):void {
            timer_.removeEventListener(TimerEvent.TIMER, update);
            for each (var item:Dot in list_) Tween24.tween(item, 1).scale(0).play();
            //Tween24.tween(list_, 1).scale(0).play();
        }
    }
}

//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);
        }
    }
//}