トンネルのような
トンネルの中を進むようなもの。
カーソルをゆっくり動かしたほうがそれっぽく見える。
マウスクリックで四角と円の切り替え
/**
* Copyright toburau ( http://wonderfl.net/user/toburau )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3LMM
*/
package {
import flash.display.*;
import flash.events.*;
[SWF(width="465", height="465", backgroundColor="0x0", frameRate="60")]
public class tunnel extends Sprite {
private var count:int = 0;
private var type:int = 0;
public function tunnel() {
Wonderfl.capture_delay(10);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.CLICK, onClick);
count = 0;
}
public function onEnterFrame(e:Event):void {
count++;
if(count > 10) {
count = 0;
addChildAt(new wall(mouseX,mouseY,type), 0);
}
}
public function onClick(e:MouseEvent):void {
type = 1 - type;
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class wall extends Sprite {
private var size:int = 10;
private var type:int = 0;
public function wall(_x:int, _y:int, _type:int) {
x = _x;
y = _y;
type = _type;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(e:Event):void {
graphics.clear();
var max:int = 0;
if(type==1) {
graphics.beginFill(0x000000);
graphics.drawRect(-1000, -1000, 2000, 2000);
graphics.drawRect(-size/2,-size/2,size,size);
graphics.endFill();
graphics.lineStyle(2,0xffffff);
graphics.drawRect(-size/2,-size/2,size,size);
max = 1000;
} else {
graphics.beginFill(0x000000);
graphics.drawCircle(0,0,1000);
graphics.drawCircle(0,0,size);
graphics.endFill();
graphics.lineStyle(2,0xffffff);
graphics.drawCircle(0,0,size);
max = 500;
}
size++;
if(size > max) {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
parent.removeChild(this);
}
}
}