※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


FORKED
  1. // forked from szktkhr's code on 2008-12-18
  2. package {
  3.     import flash.display.Sprite;
  4.     import flash.display.DisplayObject;
  5.     import flash.display.StageAlign;
  6.     import flash.display.StageScaleMode;
  7.     import flash.events.Event;
  8.     import flash.geom.Point;
  9.     
  10.     public class Main extends Sprite {
  11.         private var camera:Point;
  12.         private var brown:Point;
  13.         
  14.         public function Main() {
  15.             camera = new Point();
  16.             brown = new Point();
  17.             addEventListener(Event.ADDED_TO_STAGE, initialize);
  18.             addEventListener(Event.ENTER_FRAME, transitionCamera);
  19.             addEventListener(Event.ENTER_FRAME, gogoBrown);
  20.         }
  21.         private function initialize(event:Event):void {
  22.             stage.align = StageAlign.TOP_LEFT;
  23.             stage.scaleMode = StageScaleMode.NO_SCALE;
  24.             brown.x = Math.random() * stage.stageWidth;
  25.             brown.y = Math.random() * stage.stageHeight;
  26.             
  27.             for (var i:uint = 25; i-- > 0;) {
  28.                 addChild(new Line(camera, brown));
  29.             }
  30.         }
  31.         private function transitionCamera(event:Event):void {
  32.             camera.x += Math.random() * 2 > 1? (Math.random() * 20) / 20: -(Math.random() * 20) / 20;
  33.             camera.y += Math.random() * 2.5 > 1? (Math.random() * 20) / 20: -(Math.random() * 20) / 20;
  34.             camera.x /= 1.01;
  35.             camera.y /= 1.01;
  36.         }
  37.         private function gogoBrown(event:Event):void {
  38.             brown.x += Math.random() * 2 > 1? (Math.random() * 10): -(Math.random() * 10);
  39.             brown.y += Math.random() * 2 > 1? (Math.random() * 10): -(Math.random() * 10);
  40.             if (brown.x < 0 || brown.x > stage.stageWidth) brown.x = Math.random() * stage.stageWidth;
  41.             if (brown.y < 0 || brown.y > stage.stageHeight) brown.y = Math.random() * stage.stageHeight;
  42.         }
  43.         public function remove(child:DisplayObject):void {
  44.             removeChild(child);
  45.         }
  46.     }
  47.     
  48. }
  49. import flash.display.Sprite;
  50. import flash.display.DisplayObject;
  51. import flash.events.Event;
  52. import flash.geom.Point;
  53. class Line extends Sprite {
  54.     private var vx:Number;
  55.     private var vy:Number;
  56.     private var vs:Number;
  57.     private var camera:Point;
  58.     private var brown:Point;
  59.     public function Line(wvp:Point, b:Point) {
  60.         camera = wvp;
  61.         brown = b;
  62.         vs = Math.random() * 50 + 100;
  63.         vx = 0;
  64.         vy = 0;
  65.         addEventListener(Event.ADDED_TO_STAGE, initialize);
  66.         addEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  67.     }
  68.     private function initialize(event:Event):void {
  69.         graphics.beginFill(0x000000);
  70.         graphics.drawCircle(002);
  71.         graphics.endFill();
  72.         x = Math.random() * stage.stageWidth;
  73.         y = Math.random() * stage.stageHeight;
  74.         addEventListener(Event.ENTER_FRAME, cruising);
  75.         addEventListener(Event.ENTER_FRAME, tail);
  76.     }
  77.     private function uninitialize(event:Event):void {
  78.         removeEventListener(Event.ADDED_TO_STAGE, initialize);
  79.         removeEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  80.         removeEventListener(Event.ENTER_FRAME, cruising);
  81.         removeEventListener(Event.ENTER_FRAME, tail);
  82.     }
  83.     private function cruising(event:Event):void {
  84.         vx += (brown.x - x) / vs;
  85.         vy += (brown.y - y) / vs;
  86.         vx /= 1.005;
  87.         vy /= 1.005;
  88.         x += vx / 1;
  89.         y += vy / 1;
  90.     }
  91.     private function tail(event:Event):void {
  92.         var tail:Tail = new Tail(this, camera);
  93.         tail.x = x;
  94.         tail.y = y;
  95.         parent.addChild(tail);
  96.     }
  97. }
  98. class Tail extends Sprite {
  99.     private var vx:Number;
  100.     private var vy:Number;
  101.     private var target:DisplayObject;
  102.     private var camera:Point;
  103.     public function Tail(targetObject:DisplayObject, camera:Point) {
  104.         target = targetObject;
  105.         this.camera = camera;
  106.         addEventListener(Event.ADDED_TO_STAGE, initialize);
  107.         addEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  108.     }
  109.     private function initialize(event:Event):void {
  110.         x = target.x;
  111.         y = target.y;
  112.         var radius:uint = 5;
  113.         graphics.beginFill(0x000000);
  114.         graphics.drawCircle(-radius / 2, -radius / 2, radius);
  115.         graphics.drawCircle(-radius / 2, -radius / 2, radius / 3);
  116.         graphics.endFill();
  117.         addEventListener(Event.ENTER_FRAME, motion);
  118.     }
  119.     private function uninitialize(event:Event):void {
  120.         removeEventListener(Event.ADDED_TO_STAGE, initialize);
  121.         removeEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  122.         removeEventListener(Event.ENTER_FRAME, motion);
  123.     }
  124.     private function motion(event:Event):void {
  125.         x += camera.x;
  126.         y += camera.y;
  127.         scaleX /= 1.09;
  128.         scaleY /= 1.09;
  129.         
  130.         if (width < 1) tellRemoveToParent();
  131.     }
  132.     private function tellRemoveToParent():void {
  133.         var p:Main = parent as Main;
  134.         p.remove(this);
  135.     }
  136. }
noswf
  1. // forked from szktkhr's code on 2008-12-18
  2. package {
  3.     import flash.display.*;
  4.     import flash.events.Event;
  5.     import flash.geom.Point;
  6.     
  7.     public class Main extends Sprite {
  8.         private var camera:Point;
  9.         private var brown:Point;
  10.         
  11.         public function Main() {
  12.             camera = new Point();
  13.             brown = new Point();
  14.             addEventListener(Event.ADDED_TO_STAGE, initialize);
  15.             addEventListener(Event.ENTER_FRAME, transitionCamera);
  16.             addEventListener(Event.ENTER_FRAME, gogoBrown);
  17.         }
  18.         private function initialize(event:Event):void {
  19.             stage.align = StageAlign.TOP_LEFT;
  20.             stage.scaleMode = StageScaleMode.NO_SCALE;
  21.             brown.x = Math.random() * stage.stageWidth;
  22.             brown.y = Math.random() * stage.stageHeight;
  23.             
  24.             for (var i:uint = 5; i-- > 0;) {
  25.                 addChild(new Line(camera, brown));
  26.             }
  27.         }
  28.         private function transitionCamera(event:Event):void {
  29.             camera.x += Math.random() * 2 > 1? (Math.random() * 20) / 20: -(Math.random() * 20) / 20;
  30.             camera.y += Math.random() * 2.5 > 1? (Math.random() * 20) / 20: -(Math.random() * 20) / 20;
  31.             //camera.x /= 1.01;
  32.             camera.y /= 1.01;
  33.         }
  34.         private function gogoBrown(event:Event):void {
  35.             brown.x += Math.random() * 2 > 1? (Math.random() * 10): -(Math.random() * 10);
  36.             brown.y += Math.random() * 2 > 1? (Math.random() * 10): -(Math.random() * 10);
  37.             if (brown.x < 0 || brown.x > stage.stageWidth) brown.x = Math.random() * stage.stageWidth;
  38.             if (brown.y < 0 || brown.y > stage.stageHeight) brown.y = Math.random() * stage.stageHeight;
  39.         }
  40.         public function remove(child:DisplayObject):void {
  41.             removeChild(child);
  42.         }
  43.     }
  44.     
  45. }
  46. import flash.display.*;
  47. import flash.events.Event;
  48. import flash.geom.Point;
  49. import flash.filters.*;
  50. class Line extends Sprite {
  51.     private var vx:Number;
  52.     private var vy:Number;
  53.     private var vs:Number;
  54.     private var camera:Point;
  55.     private var brown:Point;
  56.         private var r:Number;
  57.     public function Line(wvp:Point, b:Point) {
  58.         camera = wvp;
  59.         brown = b;
  60.         vs = Math.random() * 50 + 100;
  61.         vx = 0;
  62.         vy = 0;
  63.         addEventListener(Event.ADDED_TO_STAGE, initialize);
  64.         addEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  65.     }
  66.     private function initialize(event:Event):void {
  67.         //graphics.beginFill(0x000000);
  68.         //graphics.drawCircle(0, 0, 2);
  69.         //graphics.endFill();
  70.                 r = Math.random() * 360;
  71.         x = Math.random() * stage.stageWidth;
  72.         y = Math.random() * stage.stageHeight;
  73.         addEventListener(Event.ENTER_FRAME, cruising);
  74.         addEventListener(Event.ENTER_FRAME, tail);
  75.     }
  76.     private function uninitialize(event:Event):void {
  77.         removeEventListener(Event.ADDED_TO_STAGE, initialize);
  78.         removeEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  79.         removeEventListener(Event.ENTER_FRAME, cruising);
  80.         removeEventListener(Event.ENTER_FRAME, tail);
  81.     }
  82.     private function cruising(event:Event):void {
  83.         vx += (brown.x - x) / vs;
  84.         vy += (brown.y - y) / vs;
  85.         vx /= 1.005;
  86.         vy /= 1.005;
  87.         x += vx / 1;
  88.         y += vy / 1;
  89.     }
  90.     private function tail(event:Event):void {
  91.         var tail:Tail = new Tail(this, camera, r+=10);
  92.         tail.x = x;
  93.         tail.y = y;
  94.         parent.addChild(tail);
  95.     }
  96. }
  97. class Tail extends Sprite {
  98.     private var vx:Number;
  99.     private var vy:Number;
  100.     private var target:DisplayObject;
  101.     private var camera:Point;
  102.         private var r:Number;
  103.         private var blur:BlurFilter;
  104.     public function Tail(targetObject:DisplayObject, camera:Point, ro:Number) {
  105.         target = targetObject;
  106.         this.camera = camera;
  107.                 r = ro;
  108.         addEventListener(Event.ADDED_TO_STAGE, initialize);
  109.         addEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  110.     }
  111.     private function initialize(event:Event):void {
  112.         x = target.x;
  113.         y = target.y;
  114.         var radius:uint = 40;
  115.         graphics.beginFill(0x99cc66);
  116.         //graphics.drawCircle(0, 0, radius);
  117.         graphics.drawCircle(-radius / 20, radius / 3);
  118.         graphics.drawCircle(-radius / 20, radius / 6);
  119.         graphics.drawCircle(0, -radius / 2, radius / 3);
  120.         graphics.drawCircle( radius / 20, radius / 3);
  121.         graphics.drawCircle( radius / 20, radius / 6);
  122.         graphics.drawCircle(0,  radius / 2, radius / 3);
  123.         graphics.endFill();
  124.         graphics.beginFill(0xcccc66);
  125.         graphics.drawCircle(0,  radius / 2, radius / 3);
  126.         graphics.endFill();
  127.                 rotation = r;
  128.                 blendMode = BlendMode.MULTIPLY;
  129.                 blur = new BlurFilter();
  130.                 blur.blurX = 2;
  131.                 blur.blurY = 2;
  132.                 filters = [blur];
  133.                 addEventListener(Event.ENTER_FRAME, motion);
  134.     }
  135.     private function uninitialize(event:Event):void {
  136.         removeEventListener(Event.ADDED_TO_STAGE, initialize);
  137.         removeEventListener(Event.REMOVED_FROM_STAGE, uninitialize);
  138.         removeEventListener(Event.ENTER_FRAME, motion);
  139.     }
  140.     private function motion(event:Event):void {
  141.         x += camera.x;
  142.         y += camera.y;
  143.         scaleX /= 1.19;
  144.         scaleY /= 1.19;
  145.                 rotation += 30;
  146.                 
  147.         blur.blurX += 1;
  148.                 blur.blurY += 1;
  149.                 filters = [blur];
  150.         if (width < 10) tellRemoveToParent();
  151.     }
  152.     private function tellRemoveToParent():void {
  153.         var p:Main = parent as Main;
  154.         p.remove(this);
  155.     }
  156. }
noswf
Get Adobe Flash Player