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

こういうのなんて言うんだっけ?

Get Adobe Flash player
by kamipoo 04 Aug 2010
  • Related works: 1
  • Talk

    kamipoo at 05 Aug 2010 09:57
    @vesperworksと話してて、たぶん「ドロネー図的な何か」という事になりましたw 全然ドロネー図じゃないですけども、、、。
    Embed
/**
 * Copyright kamipoo ( http://wonderfl.net/user/kamipoo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jb6b
 */

package
{
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageQuality;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.geom.Point;
    
    import net.hires.debug.Stats;
    
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.easing.Quad;
    import org.libspark.betweenas3.tweens.ITween;
    
    [SWF(frameRate="60")]
    
    public class Test extends Sprite
    {
        
        private var _terminals:Array = [];
        
        public function Test()
        {
            super();
            
            //Wonderfl.capture_delay( 5 );
            
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            stage.quality = StageQuality.LOW;
            stage.addChild(new Stats());
            
            _init();
        }
        
        private function _init():void
        {
            _initTerminals();
            
            addEventListener(Event.ENTER_FRAME, _enterframeHandler);
        }
        
        private function _initTerminals():void
        {
            _terminals = [];
            for(var i:int = 0, l:int = 100; i < l; i++) {
                var p:Particle = new Particle();
                p.x = Math.random() * stage.stageWidth;
                p.y = Math.random() * stage.stageHeight;
                _terminals[_terminals.length] = addChild(p);
                var ii:int = 10;
                var tweens:Array = [];
                while(ii--) tweens[tweens.length] = BetweenAS3.to(p, {x: Math.random() * stage.stageWidth, y: Math.random() * stage.stageHeight}, Math.random()*4+1, Quad.easeInOut);
                tweens[tweens.length] = BetweenAS3.to(p, {x: p.x, y: p.y}, Math.random()*4+1, Quad.easeInOut);
                var t:ITween = BetweenAS3.serialTweens(tweens);
                t.stopOnComplete = false;
                t.play();
            }
        }
        
        private function _enterframeHandler(e:Event):void
        {
            var g:Graphics = graphics;
            g.clear();
            g.beginFill(0x000000, 1);
            g.drawRect(0, 0, stage.stageWidth, stage.stageWidth);
            g.endFill();
            g.lineStyle(0, 0x666666, 1);
            
            for(var i:int = 0, l:int = _terminals.length; i < l; i++) {
                var parent:Particle = _terminals[i];
                parent.point.x = parent.x;
                parent.point.y = parent.y;
                for(var ii:int = i+1, ll:int = _terminals.length; ii < ll; ii++) {
                    if(i==ii) continue;
                    var target:Particle = _terminals[ii];
                    target.point.x = target.x;
                    target.point.y = target.y;
                    var dist:Number = Point.distance(parent.point, target.point);
                    if(dist < 50) {
                        g.moveTo(parent.x, parent.y);
                        g.lineTo(target.x, target.y);
                    }
                }
            }
        }
        
    }
}
import flash.display.Graphics;
import flash.display.Shape;
import flash.geom.Point;

class Particle extends Shape {
    
    public var point:Point = new Point();
    
    public function Particle()
    {
        super();
        
        var g:Graphics = graphics;
        g.beginFill(0xFFFFFF, 1);
        g.drawCircle(0, 0, 2);
        g.endFill();
        
    }
}