forked from: Like Warp ver.LITE
サイトにこれ使ってみたけど、このくらいの重さならセーフ・・・?
http://ton-up.net/
// forked from ton's Like Warp ver.LITE
// forked from ton's ワープっぽいなにか
/*
サイトにこれ使ってみたけど、このくらいの重さならセーフ・・・?
http://ton-up.net/
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.ColorMatrixFilter;
import flash.filters.GlowFilter;
import flash.geom.Point;
[SWF(width=465, height=465, frameRate=30, backgroundColor=0x000000)]
public class Warp extends Sprite {
private const R:int = 5000;
private const DEPTH:int = 3000;
private const SIZE:int = 200;
private const N:int = 3;
private const SPEED:Number = 40;
private var list:Array = [];
public function Warp() {
stage.quality = "low";
transform.perspectiveProjection.fieldOfView = 175;
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
private function onEnterFrameHandler(e:Event):void {
transform.perspectiveProjection.projectionCenter = new Point(mouseX, mouseY);
var sp:Sprite;
var cnt:int = 0;
for each(sp in list){
if(sp.z > 0){
sp.z -= SPEED;
if(sp.z <= 0) if (sp.parent == this) removeChild(sp);
}else if(cnt++ < N){
sp.z = DEPTH;
addChild(sp);
}
}
if(cnt < N){
for(var i:int = cnt; i < N; i++){
sp = new Sprite();
sp.graphics.beginFill(0xffffff);
sp.graphics.drawRect(-SIZE/2, -SIZE/2, SIZE, SIZE);
sp.graphics.endFill();
sp.filters = [
new GlowFilter (0xffffff, 1, 2 * SIZE, 2 * SIZE, 5),
new ColorMatrixFilter ([
0, 0, 0, 1, 0,
0, 1, 0, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 1, 0
])
];
var rad:Number = Math.random() * 2 * Math.PI;
sp.x = R * Math.cos(rad);
sp.y = R * Math.sin(rad);
sp.z = Math.random() * 100 + DEPTH;
sp.rotationX = 180-Math.atan2(sp.y, sp.x) * 180 / Math.PI;
sp.rotationY = 90;
list.push(sp);
}
}
}
}
}