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

flash on 2010-1-22

original from http://yamasv.blog92.fc2.com/blog-entry-166.html
size 52 -> 8
size 30 -> 5
size 50 -> 21 !?
Get Adobe Flash player
by km5291jp 22 Jan 2010
    Embed
/**
 * Copyright km5291jp ( http://wonderfl.net/user/km5291jp )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/cajT
 */

package{
	// original from http://yamasv.blog92.fc2.com/blog-entry-166.html
	// size 52 -> 8
	// size 30 -> 5
	// size 50 -> 21 !? 
        import flash.display.*;
        import flash.events.*;
        import flash.geom.*;
        import flash.utils.*;
        
        import caurina.transitions.Tweener;
        import caurina.transitions.properties.CurveModifiers;       
        [SWF(width="550", height="200",backgroundColor="0xcccccc")]
        
        public class PerfectShufful extends Sprite{
                
                private var balls:Array = [];
                // private const SIZE:int = 52;               
	            private const SIZE:int = 30;               
                private var Y:int = 100;
                private var INTERVAL:int = 10;
                
                private var RADIUS:int = 4;
                public function PerfectShufful(){
                        Tweener.init(stage);
                        CurveModifiers.init();

                        for(var i:int = 0 ; i < SIZE ; i++){
                                var c:int = ((i*(SIZE/4)) << 16) + ((i*(SIZE/4)) << 8);
                                var b:Ball = new Ball(c,RADIUS);
                                
                                balls.push(b);
                                addChild(b);
                                b.x = i*INTERVAL+RADIUS;
                                b.y = Y;
                        }
                        stage.addEventListener(MouseEvent.MOUSE_DOWN, function(e:*){shuffle();});
                }
                
                private function shuffle() : void{
                    var temp:Array=new Array(balls.length);
                    for(var i:int = 0 ; i < balls.length ; i++){
                        var j:int = (i == balls.length - 1) ? balls.length - 1 : (i*2) % (SIZE-1);

                        var b:Ball = balls[i];
                        var sign:int = (i < (balls.length / 2)) ? -1 : 1;

                        Tweener.addTween(b, {x:j*INTERVAL+RADIUS, y:Y,
                                _bezier:[{x:i*INTERVAL+RADIUS, y:Y+30*sign}, {x:j*INTERVAL+RADIUS, y:Y+30*sign},],
                                time:1, transition:"linear"} );

                        temp[j] = b;
                    }
                    balls = temp;
                }
        }
}

import flash.display.*;
internal class Ball extends Sprite{
        public function Ball(color:int, radius:int){
                graphics.beginFill(color);
                graphics.drawCircle(0,0,radius);
                graphics.endFill();
        }
}