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


embed

FORKED
  1. // forked from sake's らせん階段を上ります。
  2. /*
  3.      らせん階段を上ります。
  4.       定数kの値でジャンプする高さを変更できます。
  5. */
  6. package
  7. {
  8.     import flash.display.Graphics;
  9.     import flash.display.Sprite;
  10.     import flash.display.StageQuality;
  11.     import flash.events.Event;
  12.     import flash.geom.Matrix3D;
  13.     [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="30")]
  14.     public class spiral extends Sprite
  15.     {
  16.         private var container:Sprite;
  17.         private var cube:Sprite;
  18.         private var nn:int;
  19.         private var xx:Number;
  20.         private var ss:Number;
  21.         // ジャンプする度合いを決める定数
  22.         private const k:Number=10;
  23.         public function spiral()
  24.         {
  25.             container=new Sprite();
  26.             container.x=465 / 2;
  27.             container.y=465 / 2;
  28.             addChild(container);
  29.             container.scaleX=container.scaleY=container.scaleZ=0.15;
  30.             nn=xx=ss=0;
  31.             cube=new Sprite;
  32.             container.addChild(cube);
  33.             cube.name="sp" + nn.toString();
  34.             nn++;
  35.             var sp0:Sprite=new Sprite();
  36.             draw(sp0.graphics);
  37.             sp0.rotationY=90;
  38.             sp0.x=50;
  39.             cube.addChild(sp0);
  40.             sp0.name="plane0";
  41.             var sp1:Sprite=new Sprite();
  42.             draw(sp1.graphics);
  43.             sp1.rotationY=-90;
  44.             sp1.x=-50;
  45.             cube.addChild(sp1);
  46.             sp1.name="plane1";
  47.             var sp2:Sprite=new Sprite();
  48.             draw(sp2.graphics);
  49.             sp2.rotationX=-90;
  50.             sp2.y=-50;
  51.             cube.addChild(sp2);
  52.             sp2.name="plane2";
  53.             var sp3:Sprite=new Sprite();
  54.             draw(sp3.graphics);
  55.             sp3.rotationX=90;
  56.             sp3.y=50;
  57.             cube.addChild(sp3);
  58.             sp3.name="plane3";
  59.             var sp4:Sprite=new Sprite();
  60.             draw(sp4.graphics);
  61.             sp4.z=-50;
  62.             cube.addChild(sp4);
  63.             sp4.name="plane4";
  64.             var sp5:Sprite=new Sprite();
  65.             draw(sp5.graphics);
  66.             sp5.z=50;
  67.             cube.addChild(sp5);
  68.             sp5.name="plane5";
  69.             var h:int=-50;
  70.             var s:Number=0;
  71.             for(var i:int=0; i < 140; i++)
  72.             {
  73.                 var sp6:Sprite=new Sprite;
  74.                 sp6.graphics.beginFill(0x00FF00, 0.3);
  75.                 sp6.graphics.drawRect(-50, -50100100);
  76.                 sp6.graphics.endFill();
  77.                 container.addChild(sp6);
  78.                 sp6.name="sp" + nn.toString();
  79.                 nn++;
  80.                 sp6.rotationX=90;
  81.                 sp6.y=-h;
  82.                 h+=10;
  83.                 sp6.x=1.1 * s * Math.cos(s * Math.PI / 180);
  84.                 sp6.z=1.1 * s * Math.sin(s * Math.PI / 180);
  85.                 s+=20;
  86.             }
  87.             container.rotationX=50;
  88.             container.rotationY=40;
  89.             addEventListener(Event.ENTER_FRAME, onFrame);
  90.         }
  91.         private function draw(g:Graphics):void
  92.         {
  93.             g.beginFill(0xFFFFFF * Math.random(), 0.7);
  94.             g.drawRect(-50, -50100100);
  95.             g.endFill();
  96.         }
  97.         private function onFrame(e:Event):void
  98.         {
  99.             cube.z=1.1 * ss * Math.sin(ss * Math.PI / 180);
  100.             cube.x=1.1 * ss * Math.cos(ss * Math.PI / 180);
  101.             cube.y=-10 * (-1 * (2 * k - 1 + 2 * Math.sqrt(k * k - k)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) + k + Math.floor(xx));
  102.             xx+=0.05;
  103.             ss+=1;
  104.             var array:Array=[];
  105.             for(var i:int=0; i < 6; i++)
  106.             {
  107.                 var sp:Sprite=cube.getChildByName("plane" + i.toString())as Sprite;
  108.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  109.                 array.push({sp:sp, z:mat.position.z});
  110.             }
  111.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  112.             for(var i:int=0; i < 6; i++)
  113.             {
  114.                 var sp:Sprite=array[i].sp as Sprite;
  115.                 cube.setChildIndex(sp, i);
  116.             }
  117.             array=[];
  118.             for(var i:int=0; i < nn; i++)
  119.             {
  120.                 var sp:Sprite=container.getChildByName("sp" + i.toString())as Sprite;
  121.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  122.                 array.push({sp:sp, z:mat.position.z});
  123.             }
  124.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  125.             for(var i:int=0; i < nn; i++)
  126.             {
  127.                 var sp:Sprite=array[i].sp as Sprite;
  128.                 container.setChildIndex(sp, i);
  129.             }
  130.         }
  131.     }
  132. }
noswf
  1. // forked from sake's らせん階段を上ります。
  2. /*
  3.      らせん階段を上ります。
  4.       定数kの値でジャンプする高さを変更できます。
  5. */
  6. package
  7. {
  8.     import flash.display.Graphics;
  9.     import flash.display.Sprite;
  10.     import flash.display.StageQuality;
  11.     import flash.events.Event;
  12.     import flash.geom.Matrix3D;
  13.     [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="30")]
  14.     public class spiral extends Sprite
  15.     {
  16.         private var container:Sprite;
  17.         private var cube:Sprite;
  18.         private var nn:int;
  19.         private var xx:Number;
  20.         private var ss:Number;
  21.         // ジャンプする度合いを決める定数
  22.         private const k:Number=10;
  23.         public function spiral()
  24.         {
  25.             container=new Sprite();
  26.             container.x=465 / 2;
  27.             container.y=465 / 2;
  28.             addChild(container);
  29.             container.scaleX=container.scaleY=container.scaleZ=0.15;
  30.             nn=xx=ss=0;
  31.             cube=new Sprite;
  32.             container.addChild(cube);
  33.             cube.name="sp" + nn.toString();
  34.             nn++;
  35.             var sp0:Sprite=new Sprite();
  36.             draw(sp0.graphics);
  37.             sp0.rotationY=90;
  38.             sp0.x=50;
  39.             cube.addChild(sp0);
  40.             sp0.name="plane0";
  41.             var sp1:Sprite=new Sprite();
  42.             draw(sp1.graphics);
  43.             sp1.rotationY=-90;
  44.             sp1.x=-50;
  45.             cube.addChild(sp1);
  46.             sp1.name="plane1";
  47.             var sp2:Sprite=new Sprite();
  48.             draw(sp2.graphics);
  49.             sp2.rotationX=-90;
  50.             sp2.y=-50;
  51.             cube.addChild(sp2);
  52.             sp2.name="plane2";
  53.             var sp3:Sprite=new Sprite();
  54.             draw(sp3.graphics);
  55.             sp3.rotationX=90;
  56.             sp3.y=50;
  57.             cube.addChild(sp3);
  58.             sp3.name="plane3";
  59.             var sp4:Sprite=new Sprite();
  60.             draw(sp4.graphics);
  61.             sp4.z=-50;
  62.             cube.addChild(sp4);
  63.             sp4.name="plane4";
  64.             var sp5:Sprite=new Sprite();
  65.             draw(sp5.graphics);
  66.             sp5.z=50;
  67.             cube.addChild(sp5);
  68.             sp5.name="plane5";
  69.             var h:int=-50;
  70.             var s:Number=0;
  71.             for(var i:int=0; i < 140; i++)
  72.             {
  73.                 var sp6:Sprite=new Sprite;
  74.                 sp6.graphics.beginFill(0x00FF00, 0.3);
  75.                 sp6.graphics.drawRect(-50, -50100100);
  76.                 sp6.graphics.endFill();
  77.                 container.addChild(sp6);
  78.                 sp6.name="sp" + nn.toString();
  79.                 nn++;
  80.                 sp6.rotationX=90;
  81.                 sp6.y=-h;
  82.                 h+=10;
  83.                 sp6.x=1.1 * s * Math.cos(s * Math.PI / 180);
  84.                 sp6.z=1.1 * s * Math.sin(s * Math.PI / 180);
  85.                 s+=20;
  86.             }
  87.             container.rotationX=50;
  88.             container.rotationY=40;
  89.             addEventListener(Event.ENTER_FRAME, onFrame);
  90.         }
  91.         private function draw(g:Graphics):void
  92.         {
  93.             g.beginFill(0xFFFFFF * Math.random(), 0.7);
  94.             g.drawRect(-50, -50100100);
  95.             g.endFill();
  96.         }
  97.         private function onFrame(e:Event):void
  98.         {
  99.             cube.z=1.1 * ss * Math.sin(ss * Math.PI / 180);
  100.             cube.x=1.1 * ss * Math.cos(ss * Math.PI / 180);
  101.             cube.y=-10 * (-1 * (2 * k - 1 + 2 * Math.sqrt(k * k - k)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) + k + Math.floor(xx));
  102.             xx+=0.05;
  103.             ss+=1;
  104.             var array:Array=[];
  105.             for(var i:int=0; i < 6; i++)
  106.             {
  107.                 var sp:Sprite=cube.getChildByName("plane" + i.toString())as Sprite;
  108.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  109.                 array.push({sp:sp, z:mat.position.z});
  110.             }
  111.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  112.             for(var i:int=0; i < 6; i++)
  113.             {
  114.                 var sp:Sprite=array[i].sp as Sprite;
  115.                 cube.setChildIndex(sp, i);
  116.             }
  117.             array=[];
  118.             for(var i:int=0; i < nn; i++)
  119.             {
  120.                 var sp:Sprite=container.getChildByName("sp" + i.toString())as Sprite;
  121.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  122.                 array.push({sp:sp, z:mat.position.z});
  123.             }
  124.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  125.             for(var i:int=0; i < nn; i++)
  126.             {
  127.                 var sp:Sprite=array[i].sp as Sprite;
  128.                 container.setChildIndex(sp, i);
  129.             }
  130.         }
  131.     }
  132. }
noswf
  1. // forked from sake's らせん階段を上ります。
  2. /*
  3.      らせん階段を上ります。
  4.       定数kの値でジャンプする高さを変更できます。
  5. */
  6. package
  7. {
  8.     import flash.display.Graphics;
  9.     import flash.display.Sprite;
  10.     import flash.display.StageQuality;
  11.     import flash.events.Event;
  12.     import flash.geom.Matrix3D;
  13.     [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="30")]
  14.     public class spiral extends Sprite
  15.     {
  16.         private var container:Sprite;
  17.         private var cube:Sprite;
  18.         private var nn:int;
  19.         private var xx:Number;
  20.         private var ss:Number;
  21.         // ジャンプする度合いを決める定数
  22.         private const k:Number=15;
  23.         public function spiral()
  24.         {
  25.             container=new Sprite();
  26.             container.x=465 / 2;
  27.             container.y=465 / 2;
  28.             addChild(container);
  29.             container.scaleX=container.scaleY=container.scaleZ=0.15;
  30.             nn=xx=ss=0;
  31.             cube=new Sprite;
  32.             container.addChild(cube);
  33.             cube.name="sp" + nn.toString();
  34.             nn++;
  35.             var sp0:Sprite=new Sprite();
  36.             draw(sp0.graphics);
  37.             sp0.rotationY=90;
  38.             sp0.x=50;
  39.             cube.addChild(sp0);
  40.             sp0.name="plane0";
  41.             var sp1:Sprite=new Sprite();
  42.             draw(sp1.graphics);
  43.             sp1.rotationY=-90;
  44.             sp1.x=-50;
  45.             cube.addChild(sp1);
  46.             sp1.name="plane1";
  47.             var sp2:Sprite=new Sprite();
  48.             draw(sp2.graphics);
  49.             sp2.rotationX=-90;
  50.             sp2.y=-50;
  51.             cube.addChild(sp2);
  52.             sp2.name="plane2";
  53.             var sp3:Sprite=new Sprite();
  54.             draw(sp3.graphics);
  55.             sp3.rotationX=90;
  56.             sp3.y=50;
  57.             cube.addChild(sp3);
  58.             sp3.name="plane3";
  59.             var sp4:Sprite=new Sprite();
  60.             draw(sp4.graphics);
  61.             sp4.z=-50;
  62.             cube.addChild(sp4);
  63.             sp4.name="plane4";
  64.             var sp5:Sprite=new Sprite();
  65.             draw(sp5.graphics);
  66.             sp5.z=50;
  67.             cube.addChild(sp5);
  68.             sp5.name="plane5";
  69.             var h:int=-50;
  70.             var s:Number=0;
  71.             for(var i:int=0; i < 140; i++)
  72.             {
  73.                 var sp6:Sprite=new Sprite;
  74.                 sp6.graphics.beginFill(0x00FF00, 0.3);
  75.                 sp6.graphics.drawRect(-50, -50100100);
  76.                 sp6.graphics.endFill();
  77.                 container.addChild(sp6);
  78.                 sp6.name="sp" + nn.toString();
  79.                 nn++;
  80.                 sp6.rotationX=90;
  81.                 sp6.y=-h;
  82.                 h+=10;
  83.                 sp6.x=1.1 * s * Math.cos(s * Math.PI / 180);
  84.                 sp6.z=1.1 * s * Math.sin(s * Math.PI / 180);
  85.                 s+=20;
  86.             }
  87.             container.rotationX=50;
  88.             container.rotationY=40;
  89.             addEventListener(Event.ENTER_FRAME, onFrame);
  90.         }
  91.         private function draw(g:Graphics):void
  92.         {
  93.             g.beginFill(0xFFFFFF * Math.random(), 0.7);
  94.             g.drawRect(-50, -50100100);
  95.             g.endFill();
  96.         }
  97.         private function onFrame(e:Event):void
  98.         {
  99.             cube.z=1.1 * ss * Math.sin(ss * Math.PI / 180);
  100.             cube.x=1.1 * ss * Math.cos(ss * Math.PI / 180);
  101.             cube.y=-10 * (-1 * (2 * k - 1 + 2 * Math.sqrt(k * k - k)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) * (xx - k + Math.sqrt(k * k - k) - Math.floor(xx)) + k + Math.floor(xx));
  102.             xx+=0.05;
  103.             ss+=1;
  104.             var array:Array=[];
  105.             for(var i:int=0; i < 6; i++)
  106.             {
  107.                 var sp:Sprite=cube.getChildByName("plane" + i.toString())as Sprite;
  108.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  109.                 array.push({sp:sp, z:mat.position.z});
  110.             }
  111.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  112.             for(var i:int=0; i < 6; i++)
  113.             {
  114.                 var sp:Sprite=array[i].sp as Sprite;
  115.                 cube.setChildIndex(sp, i);
  116.             }
  117.             array=[];
  118.             for(var i:int=0; i < nn; i++)
  119.             {
  120.                 var sp:Sprite=container.getChildByName("sp" + i.toString())as Sprite;
  121.                 var mat:Matrix3D=sp.transform.getRelativeMatrix3D(this);
  122.                 array.push({sp:sp, z:mat.position.z});
  123.             }
  124.             array.sortOn("z"Array.NUMERIC | Array.DESCENDING);
  125.             for(var i:int=0; i < nn; i++)
  126.             {
  127.                 var sp:Sprite=array[i].sp as Sprite;
  128.                 container.setChildIndex(sp, i);
  129.             }
  130.         }
  131.     }
  132. }
noswf
Get Adobe Flash Player