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


embed

FORKED
  1. // forked from sake's マウスから逃げる
  2. /*
  3.     マウスから逃げます。
  4. */
  5. package
  6. {
  7.     import flash.display.BlendMode;
  8.     import flash.display.Shape;
  9.     import flash.display.Sprite;
  10.     import flash.events.Event;
  11.     import flash.filters.BlurFilter;
  12.     import funnel.*;
  13.     import funnel.gui.*;
  14.     [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
  15.     public class RunAwayFromMouse extends Sprite
  16.     {
  17.         private var num:int=500;
  18.         private var firstPointX:Array=new Array();
  19.         private var firstPointY:Array=new Array();
  20.         private var fio:Fio;
  21.         
  22.         public function RunAwayFromMouse()
  23.         {
  24.             var config:Configuration = Fio.FIRMATA;
  25.             fio = new Fio([1], config);
  26.             
  27.                         for(var i:int=0; i < num; i++)
  28.             {
  29.                 var circle:Shape=new Shape();
  30.                 circle.graphics.beginFill(Math.random() * 0xFFFFFF);
  31.                 circle.graphics.drawCircle(00, Math.random() * 18 + 5);
  32.                 circle.graphics.endFill();
  33.                 circle.blendMode=BlendMode.ADD;
  34.                 circle.x=Math.round(Math.random() * stage.stageWidth);
  35.                 circle.y=Math.round(Math.random() * stage.stageHeight);
  36.                 circle.name="circle" + i.toString();
  37.                 circle.filters=[new BlurFilter(10101)];
  38.                 addChild(circle);
  39.                 firstPointX[i]=circle.x;
  40.                 firstPointY[i]=circle.y;
  41.             }
  42.             addEventListener(Event.ENTER_FRAME, onFrame);
  43.         }
  44.         public function onFrame(e:Event):void
  45.         {
  46.             for(var i:int=0; i < num; i++)
  47.             {
  48.                 var circle:Shape=getChildByName("circle" + i.toString())as Shape;
  49.                 //var theta:Number=Math.atan2(circle.y - mouseY, circle.x - mouseX);
  50.                 var theta:Number=Math.atan2(circle.y - fio.ioModule(1).analogPin(0).value * 465, circle.x - fio.ioModule(1).analogPin(0).value * 465);
  51.                 //var d:Number=1000 / Math.sqrt(Math.pow(mouseX - circle.x, 2) + Math.pow(mouseY - circle.y, 2));
  52.                 var d:Number=1000 / Math.sqrt(Math.pow(fio.ioModule(1).analogPin(0).value * 465 - circle.x, 2) + Math.pow(fio.ioModule(1).analogPin(0).value * 465 - circle.y, 2));
  53.                 circle.x+=d * Math.cos(theta) + (firstPointX[i] - circle.x) * 0.1;
  54.                 circle.y+=d * Math.sin(theta) + (firstPointY[i] - circle.y) * 0.1;
  55.             }
  56.         }
  57.     }
  58. }
noswf
  1. // forked from sake's マウスから逃げる
  2. /*
  3.     マウスから逃げます。
  4. */
  5. package
  6. {
  7.     import flash.display.BlendMode;
  8.     import flash.display.Shape;
  9.     import flash.display.Sprite;
  10.     import flash.events.Event;
  11.     import flash.filters.BlurFilter;
  12.     [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
  13.     public class RunAwayFromMouse extends Sprite
  14.     {
  15.         private var num:int=500;
  16.         private var firstPointX:Array=new Array();
  17.         private var firstPointY:Array=new Array();
  18.         public function RunAwayFromMouse()
  19.         {
  20.             for(var i:int=0; i < num; i++)
  21.             {
  22.                 var circle:Shape=new Shape();
  23.                 circle.graphics.beginFill(Math.random() * 0xFFFFFF);
  24.                 circle.graphics.drawCircle(00, Math.random() * 18 + 5);
  25.                 circle.graphics.endFill();
  26.                 circle.blendMode=BlendMode.ADD;
  27.                 circle.x=Math.round(Math.random() * stage.stageWidth);
  28.                 circle.y=Math.round(Math.random() * stage.stageHeight);
  29.                 circle.name="circle" + i.toString();
  30.                 circle.filters=[new BlurFilter(10101)];
  31.                 addChild(circle);
  32.                 firstPointX[i]=circle.x;
  33.                 firstPointY[i]=circle.y;
  34.             }
  35.             addEventListener(Event.ENTER_FRAME, onFrame);
  36.         }
  37.         public function onFrame(e:Event):void
  38.         {
  39.             for(var i:int=0; i < num; i++)
  40.             {
  41.                 var circle:Shape=getChildByName("circle" + i.toString())as Shape;
  42.                 var theta:Number=Math.atan2(circle.y - mouseY, circle.x - mouseX);
  43.                 var d:Number=1000 / Math.sqrt(Math.pow(mouseX - circle.x, 2) + Math.pow(mouseY - circle.y, 2));
  44.                 circle.x+=d * Math.cos(theta) + (firstPointX[i] - circle.x) * 0.1;
  45.                 circle.y+=d * Math.sin(theta) + (firstPointY[i] - circle.y) * 0.1;
  46.             }
  47.         }
  48.     }
  49. }
noswf
  1. // forked from sake's マウスから逃げる
  2. /*
  3.     マウスから逃げます。
  4. */
  5. package
  6. {
  7.     import flash.display.BlendMode;
  8.     import flash.display.Shape;
  9.     import flash.display.Sprite;
  10.     import flash.events.Event;
  11.     import flash.filters.BlurFilter;
  12.     [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
  13.     public class RunAwayFromMouse extends Sprite
  14.     {
  15.         private var num:int=500;
  16.         private var firstPointX:Array=new Array();
  17.         private var firstPointY:Array=new Array();
  18.         public function RunAwayFromMouse()
  19.         {
  20.             for(var i:int=0; i < num; i++)
  21.             {
  22.                 var circle:Shape=new Shape();
  23.                 circle.graphics.beginFill(Math.random() * 0xFFFFFF);
  24.                 circle.graphics.drawCircle(00, Math.random() * 18 + 5);
  25.                 circle.graphics.endFill();
  26.                 circle.blendMode=BlendMode.ADD;
  27.                 circle.x=Math.round(Math.random() * stage.stageWidth);
  28.                 circle.y=Math.round(Math.random() * stage.stageHeight);
  29.                 circle.name="circle" + i.toString();
  30.                 circle.filters=[new BlurFilter(10101)];
  31.                 addChild(circle);
  32.                 firstPointX[i]=circle.x;
  33.                 firstPointY[i]=circle.y;
  34.             }
  35.             addEventListener(Event.ENTER_FRAME, onFrame);
  36.         }
  37.         public function onFrame(e:Event):void
  38.         {
  39.             for(var i:int=0; i < num; i++)
  40.             {
  41.                 var circle:Shape=getChildByName("circle" + i.toString())as Shape;
  42.                 var theta:Number=Math.atan2(circle.y - mouseY, circle.x - mouseX);
  43.                 var d:Number=1000 / Math.sqrt(Math.pow(mouseX - circle.x, 2) + Math.pow(mouseY - circle.y, 2));
  44.                 circle.x+=d * Math.cos(theta) + (firstPointX[i] - circle.x) * 0.1;
  45.                 circle.y+=d * Math.sin(theta) + (firstPointY[i] - circle.y) * 0.1;
  46.             }
  47.         }
  48.     }
  49. }
noswf
  1. // forked from sake's マウスから逃げる
  2. /*
  3.     マウスから逃げます。
  4. */
  5. package
  6. {
  7.     import flash.display.BlendMode;
  8.     import flash.display.Shape;
  9.     import flash.display.Sprite;
  10.     import flash.events.Event;
  11.     import flash.filters.BlurFilter;
  12.     [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
  13.     public class RunAwayFromMouse extends Sprite
  14.     {
  15.         private var num:int=500;
  16.         private var firstPointX:Array=new Array();
  17.         private var firstPointY:Array=new Array();
  18.         public function RunAwayFromMouse()
  19.         {
  20.             for(var i:int=0; i < num; i++)
  21.             {
  22.                 var circle:Shape=new Shape();
  23.                 circle.graphics.beginFill(Math.random() * 0xFFFFFF);
  24.                 circle.graphics.drawCircle(00, Math.random() * 18 + 5);
  25.                 circle.graphics.endFill();
  26.                 circle.blendMode=BlendMode.ADD;
  27.                 circle.x=Math.round(Math.random() * stage.stageWidth);
  28.                 circle.y=Math.round(Math.random() * stage.stageHeight);
  29.                 circle.name="circle" + i.toString();
  30.                 circle.filters=[new BlurFilter(10101)];
  31.                 addChild(circle);
  32.                 firstPointX[i]=circle.x;
  33.                 firstPointY[i]=circle.y;
  34.             }
  35.             addEventListener(Event.ENTER_FRAME, onFrame);
  36.         }
  37.         public function onFrame(e:Event):void
  38.         {
  39.             for(var i:int=0; i < num; i++)
  40.             {
  41.                 var circle:Shape=getChildByName("circle" + i.toString())as Shape;
  42.                 var theta:Number=Math.atan2(circle.y - mouseY, circle.x - mouseX);
  43.                 var d:Number=1000 / Math.sqrt(Math.pow(mouseX - circle.x, 2) + Math.pow(mouseY - circle.y, 2));
  44.                 circle.x+=d * Math.cos(theta) + (firstPointX[i] - circle.x) * 0.1;
  45.                 circle.y+=d * Math.sin(theta) + (firstPointY[i] - circle.y) * 0.1;
  46.             }
  47.         }
  48.     }
  49. }
noswf
  1. // forked from sake's マウスから逃げる
  2. /*
  3.     マウスから逃げます。
  4. */
  5. /*--
  6. 元気玉
  7. ----*/
  8. package
  9. {
  10.     import flash.display.BlendMode;
  11.     import flash.display.Shape;
  12.     import flash.display.Sprite;
  13.     import flash.events.Event;
  14.     import flash.filters.BlurFilter;
  15.     [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
  16.     public class RunAwayFromMouse extends Sprite
  17.     {
  18.         private var num:int=700;
  19.         private var firstPointX:Array=new Array();
  20.         private var firstPointY:Array=new Array();
  21.         public function RunAwayFromMouse()
  22.         {
  23.             for(var i:int=0; i < num; i++)
  24.             {
  25.                 var circle:Shape=new Shape();
  26.                 circle.graphics.beginFill(0x6699);
  27.                 circle.graphics.drawCircle(00, Math.random() * 20 );
  28.                 circle.graphics.endFill();
  29.                 circle.blendMode=BlendMode.ADD;
  30.                 circle.x=Math.round(Math.random() * stage.stageWidth);
  31.                 circle.y=Math.round(Math.random() * stage.stageHeight);
  32.                 circle.name="circle" + i.toString();
  33.                 circle.filters=[new BlurFilter(10101)];
  34.                 addChild(circle);
  35.                 firstPointX[i]=circle.x;
  36.                 firstPointY[i]=circle.y;
  37.             }
  38.             addEventListener(Event.ENTER_FRAME, onFrame);
  39.         }
  40.         public function onFrame(e:Event):void
  41.         {
  42.             for(var i:int=0; i < num; i++)
  43.             {
  44.                 var circle:Shape=getChildByName("circle" + i.toString())as Shape;
  45.                 var theta:Number=Math.atan2(circle.y - mouseY, circle.x - mouseX);
  46.                 var d:Number=1000 / Math.sqrt(Math.pow(mouseX - circle.x, 2) + Math.pow(mouseY - circle.y, 2));
  47. //dの値は距離が近い程大きくなって、最後には、無限に近い速度で、画面の外へと飛んでいくので、画面の枠の外からどんどんでてくるように見える。
  48.                 circle.x+= -d * Math.cos(theta) //+ (firstPointX[i] - circle.x) * 0.1;
  49.                 circle.y+= -d * Math.sin(theta) //+ (firstPointY[i] - circle.y) * 0.1;
  50.             }
  51.         }
  52.     }
  53. }
noswf
Get Adobe Flash Player