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

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

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


forked from : butr0s's Bounce [diff(9)]

FORKED
  1. // forked from fukt's forked from: Bounce
  2. // forked from butr0s's Bounce
  3. package {
  4.     import flash.display.Sprite;
  5.     [SWF(width="640", height="480", backgroundColor="0x003300", frameRate="30")]
  6.     public class Bounce extends Sprite {
  7.         public function Bounce():void {    main = this; initialize(); }
  8.     }
  9. }
  10. import flash.display.*;
  11. import flash.events.*;
  12. const SCREEN_WIDTH:int = 640, SCREEN_HEIGHT:int = 480;
  13. var main:Sprite, g:Graphics;
  14. var collections:Array = new Array();
  15. var color:int = 0x00ff00;
  16. var ticks:int = 10;
  17. var start:Collection = new Collection();
  18. function initialize():void {
  19.     g = main.graphics;
  20.     main.addEventListener(Event.ENTER_FRAME, update);
  21. }
  22. function update():void {
  23.     g.clear();
  24.     ticks++;
  25.     
  26.     if(collections.length < 10 && ticks > 2) {
  27.         ticks = 0;
  28.         var blur:Collection = new Collection();
  29.         for(var i:int = 0; i < blur.contents.length; i++) {
  30.             blur.contents[i].position.x = start.contents[i].position.x;
  31.             blur.contents[i].position.y = start.contents[i].position.y;
  32.             blur.contents[i].velocity.x = start.contents[i].velocity.x;
  33.             blur.contents[i].velocity.y = start.contents[i].velocity.y;
  34.         }
  35.         collections.push(blur);
  36.     }
  37.     
  38.     var thickness:int = 1, alpha:Number = 1;
  39.     for each(var c:Collection in collections) {
  40.         thickness += 0.1; alpha -= 0.0;
  41.         c.update(thickness, color, alpha);
  42.     }
  43. }
  44. class Collection {
  45.     public var contents:Array = new Array();
  46.     
  47.     public function Collection():void {
  48.         contents.push(new Point());
  49.         contents.push(new Point());
  50.         contents.push(new Point());
  51.         contents.push(new Point());
  52.     }
  53.     public function update(width:int = 3, color:int = 0xff0000, alpha:Number = 0.1):void {
  54.         // Update individual points
  55.         for each(var p:Point in contents) p.update();
  56.         
  57.         // Draw lines
  58.         g.lineStyle(width, color, alpha);
  59.         g.moveTo(contents[contents.length - 1].position.x, contents[contents.length - 1].position.y);
  60.         for each(p in contents) g.lineTo(p.position.x, p.position.y);
  61.     }
  62. }
  63. class Point {
  64.     public var position:Object = new Object;
  65.     public var velocity:Object = new Object;
  66.     
  67.     public function Point():void {
  68.         position.x = Math.random() * SCREEN_WIDTH;
  69.         position.y = Math.random() * SCREEN_HEIGHT;
  70.         velocity.x = Math.random() * 30;
  71.         velocity.y = Math.random() * 30;
  72.     }
  73.     
  74.     public function update():void {
  75.         // Move
  76.         position.x += velocity.x;
  77.         position.y += velocity.y;
  78.         
  79.         if(position.x < 0 || position.x > SCREEN_WIDTH)    velocity.x *= -1;
  80.         if(position.y < 0 || position.y > SCREEN_HEIGHT) velocity.y *= -1;
  81.     }
  82. }
noswf
Get Adobe Flash Player