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

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

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


forked from : ll_koba_ll's 3D cube [diff(41)]

FORKED
  1. // forked from Yaski's 3D cube with motion blur
  2. // forked from ll_koba_ll's 3D cube
  3. // write as3 code here..
  4. package {
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.geom.*;
  9.     [SWF(frameRate="1000", backgroundColor="#011000")]  
  10.     public class Cube extends Sprite {
  11.         private var sp:Sprite;
  12.         private var canvas:Sprite = new Sprite();
  13.         private var faceArray:Array;
  14.         private const CUBE_SCALE:int = 50
  15.         private var dirX:Boolean = false;
  16.         private var dirY:Boolean = false;
  17.         private var dirZ:Boolean = false;
  18.         private var bmp:Bitmap;
  19.         private var fadeTransform:ColorTransform = new ColorTransform(00.70);
  20.         public function Cube() {                        
  21.             init();
  22.             bmp = new Bitmap(new BitmapData(300300false, 0x0));
  23.             bmp.smoothing = true;
  24.             bmp.width = stage.stageWidth;
  25.             bmp.height = stage.stageHeight;
  26.             addChild(bmp);
  27.         }
  28.         private function init():void {
  29.             createCubeFace();
  30.             addEventListener(Event.ENTER_FRAME, function(e:Event):void {
  31.                 sp.rotationY += 1;
  32.                 sp.rotationX += 2;
  33.                 sp.x = (dirX) ? sp.x + 8 : sp.x - 1;
  34.                 sp.y = (dirY) ? sp.y + 6 : sp.y - 6;
  35.                 sp.z = (dirZ) ? sp.z + 2 : sp.z - 2;
  36.                 if (sp.x >= 300 || sp.x <= 20) {dirX = !dirX};
  37.                 if (sp.y >= 250 || sp.y <= 0) {dirY = !dirY};
  38.                 if (sp.z >= 300 || sp.z <= 10) {dirZ = !dirZ};
  39.                 bmp.bitmapData.colorTransform(bmp.bitmapData.rect, fadeTransform);
  40.                 bmp.bitmapData.draw(canvas);
  41.             });
  42.         }
  43.         private function createCubeFace():void {
  44.             sp = new Sprite();
  45.             canvas.addChild(sp);
  46.             sp.x = 200;
  47.             sp.y = 200;
  48.             var s:Sprite;
  49.             faceArray = new Array();
  50.             function createFace(c:uint):Sprite {
  51.                 var s:Sprite = new Sprite();
  52.                 drawRect(s, c);
  53.                 sp.addChild(s);
  54.                 return s
  55.             }
  56.             
  57.             // 背面
  58.             s = createFace(0xff0000);
  59.             s.z = CUBE_SCALE/2;
  60.             var t:TextField = new TextField();
  61.             s.addChild(t);
  62.             t.text = "AS 3 is COOL!!!";
  63.             t.autoSize = TextFieldAutoSize.LEFT;
  64.             t.setTextFormat(new TextFormat("_ゴシック"15, 0xFF0000));
  65.             t.x = -10
  66.             t.y = -20
  67.             
  68.             // 左
  69.             s = createFace(0x0000ff);
  70.             s.rotationY = 90;
  71.             s.x = -CUBE_SCALE/2;
  72.             
  73.             // 右
  74.             s = createFace(0x00ff00);
  75.             s.rotationY = 90;
  76.             s.x = CUBE_SCALE/2;
  77.             
  78.             // 上
  79.             s = createFace(0xffff00);
  80.             s.rotationX = 90;
  81.             s.y = -CUBE_SCALE/2;
  82.             // 下
  83.             s = createFace(0x00ffff);
  84.             s.rotationX = 90;
  85.             s.y = CUBE_SCALE/2;
  86.             // 前面
  87.             s = createFace(0xaaaaaa);
  88.             s.z = -CUBE_SCALE/1;
  89.             t = new TextField();
  90.             s.addChild(t);
  91.             t.text = "Updated by Яски";
  92.             t.autoSize = TextFieldAutoSize.LEFT;
  93.             t.setTextFormat(new TextFormat("_ゴシック"15, 0xFF));
  94.             t.x = -50
  95.             t.y = -20
  96.         }
  97.         private function drawRect(s:Sprite, c:uint):void {
  98.             var g:Graphics = s.graphics;
  99.             g.lineStyle(2, 0xFF00);
  100.             g.beginFill(c, 1); // z sort してないから塗りは消しておく
  101.             g.drawRect(-CUBE_SCALE/2, -CUBE_SCALE/2, CUBE_SCALE, CUBE_SCALE);
  102.             g.endFill();
  103.         }
  104.     }
  105. }
noswf
  1. // forked from Yaski's 3D cube with motion blur
  2. // forked from ll_koba_ll's 3D cube
  3. // write as3 code here..
  4. package {
  5.     import flash.display.*;
  6.     import flash.text.*;
  7.     import flash.events.*;
  8.     import flash.geom.*;
  9.     [SWF(frameRate="100", backgroundColor="#000000")]  
  10.     public class Cube extends Sprite {
  11.         private var sp:Sprite;
  12.         private var canvas:Sprite = new Sprite();
  13.         private var faceArray:Array;
  14.         private const CUBE_SCALE:int = 100;
  15.         private var dirX:Boolean = false;
  16.         private var dirY:Boolean = false;
  17.         private var dirZ:Boolean = false;
  18.         private var bmp:Bitmap;
  19.         private var fadeTransform:ColorTransform = new ColorTransform(00.70);
  20.         public function Cube() {                        
  21.             init();
  22.             bmp = new Bitmap(new BitmapData(300300false, 0x0));
  23.             bmp.smoothing = true;
  24.             bmp.width = stage.stageWidth;
  25.             bmp.height = stage.stageHeight;
  26.             addChild(bmp);
  27.         }
  28.         private function init():void {
  29.             createCubeFace();
  30.             addEventListener(Event.ENTER_FRAME, function(e:Event):void {
  31.                 sp.rotationY += 1;
  32.                 sp.rotationX += 1;
  33.                 sp.x = (dirX) ? sp.x + 8 : sp.x - 8;
  34.                 sp.y = (dirY) ? sp.y + 6 : sp.y - 6;
  35.                 sp.z = (dirZ) ? sp.z + 2 : sp.z - 2;
  36.                 if (sp.x >= 300 || sp.x <= 20) {dirX = !dirX};
  37.                 if (sp.y >= 250 || sp.y <= 0) {dirY = !dirY};
  38.                 if (sp.z >= 300 || sp.z <= 10) {dirZ = !dirZ};
  39.                 bmp.bitmapData.colorTransform(bmp.bitmapData.rect, fadeTransform);
  40.                 bmp.bitmapData.draw(canvas);
  41.             });
  42.         }
  43.         private function createCubeFace():void {
  44.             sp = new Sprite();
  45.             canvas.addChild(sp);
  46.             sp.x = 200;
  47.             sp.y = 200;
  48.             var s:Sprite;
  49.             faceArray = new Array();
  50.             function createFace(c:uint):Sprite {
  51.                 var s:Sprite = new Sprite();
  52.                 drawRect(s, c);
  53.                 sp.addChild(s);
  54.                 return s
  55.             }
  56.             
  57.             // 背面
  58.             s = createFace(0xff0000);
  59.             s.z = CUBE_SCALE/2;
  60.             var t:TextField = new TextField();
  61.             s.addChild(t);
  62.             t.text = "AS 3 is COOL!!!";
  63.             t.autoSize = TextFieldAutoSize.LEFT;
  64.             t.setTextFormat(new TextFormat("_ゴシック"15, 0xFF0000));
  65.             t.x = -50
  66.             t.y = -20
  67.             
  68.             // 左
  69.             s = createFace(0x0000ff);
  70.             s.rotationY = 90;
  71.             s.x = -CUBE_SCALE/2;
  72.             
  73.             // 右
  74.             s = createFace(0x00ff00);
  75.             s.rotationY = 90;
  76.             s.x = CUBE_SCALE/2;
  77.             
  78.             // 上
  79.             s = createFace(0xffff00);
  80.             s.rotationX = 90;
  81.             s.y = -CUBE_SCALE/2;
  82.             // 下
  83.             s = createFace(0x00ffff);
  84.             s.rotationX = 90;
  85.             s.y = CUBE_SCALE/2;
  86.             // 前面
  87.             s = createFace(0xaaaaaa);
  88.             s.z = -CUBE_SCALE/2;
  89.             t = new TextField();
  90.             s.addChild(t);
  91.             t.text = "Updated by Яски";
  92.             t.autoSize = TextFieldAutoSize.LEFT;
  93.             t.setTextFormat(new TextFormat("_ゴシック"15, 0xFF));
  94.             t.x = -50
  95.             t.y = -20
  96.         }
  97.         private function drawRect(s:Sprite, c:uint):void {
  98.             var g:Graphics = s.graphics;
  99.             g.lineStyle(2, 0xFF00);
  100.             g.beginFill(c, 0); // z sort してないから塗りは消しておく
  101.             g.drawRect(-CUBE_SCALE/2, -CUBE_SCALE/2, CUBE_SCALE, CUBE_SCALE);
  102.             g.endFill();
  103.         }
  104.     }
  105. }
noswf
Get Adobe Flash Player