forked from: 無限襖
// forked from rsakane's 無限襖
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import flash.geom.Matrix;
[SWF(width="465", height="465", frameRate="30", backgroundColor="0x9d874a")]
public class Main extends Sprite
{
private var husuma:Vector.<Husuma> = new Vector.<Husuma>();
private var yuka:Vector.<Husuma> = new Vector.<Husuma>();
private var tenjo:Vector.<Husuma> = new Vector.<Husuma>();
private var frame:int = 0;
private var operation:int = 0;
private var pc:Point = new Point();
public function Main()
{
var matrix:Matrix = new Matrix();
matrix.createGradientBox(465, 200, 90 * Math.PI / 180);
graphics.beginGradientFill("linear", [0xd5cf95, 0x9d874a], [1.0, 1.0], [0, 255], matrix);
graphics.drawRect(0, 0, 465, 200);
graphics.endFill();
matrix.createGradientBox(465, 200, 90 * Math.PI / 180, 0, 265);
graphics.beginGradientFill("linear", [0x9d874a, 0xd5cf95], [1.0, 1.0], [0, 255], matrix);
graphics.drawRect(0, 265, 465, 200);
graphics.endFill();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void
{
for (var i:int = 0; i < husuma.length; i++)
{
husuma[i].z += 18;
yuka[i].z += 18;
tenjo[i].z += 18;
if (i % 4 == 0 && husuma[i].x < 0)
{
husuma[i].x+=6;
husuma[i + 1].x-=6;
yuka[i].x+=6;
yuka[i + 1].x-=6;
tenjo[i].x+=6;
tenjo[i + 1].x-=6;
}
}
if (frame % 25 == 0)
{
var boxLEFT:Husuma = new Husuma();
boxLEFT.x = -232;
addChild(boxLEFT);
husuma.push(boxLEFT);
var boxRIGHT:Husuma = new Husuma(1);
boxRIGHT.x = 465;
addChild(boxRIGHT);
husuma.push(boxRIGHT);
var boxML:Husuma = new Husuma(1);
boxML.x = -232;
addChild(boxML);
husuma.push(boxML);
var boxMR:Husuma = new Husuma();
boxMR.x = 465;
addChild(boxMR);
husuma.push(boxMR);
var yukaLEFT:Husuma = new Husuma();
yukaLEFT.x = -232;
yukaLEFT.y = 465;
yukaLEFT.rotationX = -90;
addChild(yukaLEFT);
yuka.push(yukaLEFT);
var yukaRIGHT:Husuma = new Husuma(1);
yukaRIGHT.x = 465;
yukaRIGHT.y = 465;
yukaRIGHT.rotationX = -90;
addChild(yukaRIGHT);
yuka.push(yukaRIGHT);
var yukaML:Husuma = new Husuma(1);
yukaML.x = -232;
yukaML.y = 465;
yukaML.rotationX = -90;
addChild(yukaML);
yuka.push(yukaML);
var yukaMR:Husuma = new Husuma();
yukaMR.x = 465;
yukaMR.y = 465;
yukaMR.rotationX = -90;
addChild(yukaMR);
yuka.push(yukaMR);
var tenjoLEFT:Husuma = new Husuma();
tenjoLEFT.x = -232;
tenjoLEFT.rotationX = -90;
addChild(tenjoLEFT);
tenjo.push(tenjoLEFT);
var tenjoRIGHT:Husuma = new Husuma(1);
tenjoRIGHT.x = 465;
tenjoRIGHT.rotationX = -90;
addChild(tenjoRIGHT);
tenjo.push(tenjoRIGHT);
var tenjoML:Husuma = new Husuma(1);
tenjoML.x = -232;
tenjoML.rotationX = -90;
addChild(tenjoML);
tenjo.push(tenjoML);
var tenjoMR:Husuma = new Husuma();
tenjoMR.x = 465;
tenjoMR.rotationX = -90;
addChild(tenjoMR);
tenjo.push(tenjoMR);
}
if (frame % 25 == 0 && frame >= 75)
{
for (i = 0; i < 4; i++)
{
removeChild(husuma[0]);
husuma[0] = null;
husuma.splice(0, 1);
removeChild(yuka[0]);
yuka[0] = null;
yuka.splice(0, 1);
removeChild(tenjo[0]);
tenjo[0] = null;
tenjo.splice(0, 1);
}
}
if (operation == 0) pc.x++, pc.y++;
else if (operation == 1) pc.y--;
else if (operation == 2) pc.x--, pc.y++;
else if (operation == 3) pc.y--;
if (operation == 0 && pc.x >= 400) trace(operation), operation = 1;
else if (operation == 1 && pc.y <= 0) trace(operation), operation = 2;
else if (operation == 2 && pc.x <= 0) trace(operation), operation = 3;
else if (operation == 3 && pc.y <= 0) trace(operation), operation = 0;
transform.perspectiveProjection.projectionCenter = pc;
frame++;
}
}
}
import flash.display.Sprite;
import flash.geom.Matrix;
class Husuma extends Sprite
{
public function Husuma(number:int = 0)
{
graphics.lineStyle(10.0);
var matrix:Matrix = new Matrix();
matrix.createGradientBox(232, 465, 0);
graphics.beginGradientFill("radial", [0xd5cf95, 0xb6a466], [1.0, 1.0], [0, 255], matrix);
graphics.drawRect(0, 0, 232, 465);
graphics.endFill();
if (number == 0)
{
graphics.beginFill(0x0);
graphics.drawCircle(200, 232, 7);
graphics.endFill();
}
else
{
graphics.beginFill(0x0);
graphics.drawCircle(32, 232, 7);
graphics.endFill();
}
}
}