ボール

by awef
zソートしてません
♥0 | Line 35 | Modified 2009-04-21 17:45:56 | MIT License
play

ActionScript3 source code

/**
 * Copyright awef ( http://wonderfl.net/user/awef )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7u7d
 */

package
{
    //zソートしてません
    import flash.display.Sprite;
    
    [SWF(frameRate = "120")]
    
    public class main extends Sprite
    {
        public function main()
        {
            for(var i:uint = 0; i < 8; i++)
            {
                stage.addChild(new ball());
            }
        }
    }
}

import flash.display.Sprite;
import caurina.transitions.Tweener;
class ball extends Sprite
{
    function ball()
    {
        Tweener.addTween(this, {time:Math.random() * 5, onComplete:run});
    }
    
    public function run():void
    {
        x = Math.random() * 450;
        y = 700;
        z = Math.random() * 125;
        
        graphics.beginFill(Math.round(Math.random() * 255 * 255 * 255));
        graphics.drawCircle(0, 0, 55);
        graphics.endFill();
        
        Tweener.addTween(this, {y:Math.random() * 250 + 100, time:0.6, transition:"easeOutCubic"});
        Tweener.addTween(this, {delay:0.6, y:700, time:1, transition:"easeInCubic", onComplete:run});
    }
}