3Dぐりぐり (1)
/**
* Copyright nacookan ( http://wonderfl.net/user/nacookan )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2qv5
*/
// forked from nacookan's 3D世界で横スクロール
package {
import flash.display.Sprite;
import flash.events.*;
[SWF(backgroundColor="0xffffff", frameRate="60")]
public class Guriguri3D extends Sprite {
public function Guriguri3D():void {
var canvas:Sprite = new Sprite();
for(var i:Number = 0; i < 500; i++){
var circle:Sprite = new Sprite();
var color:Number = rnd(255 * 255 * 255);
var alpha:Number = (rnd(40) + 20) / 100;
circle.graphics.beginFill(color, alpha);
circle.graphics.drawCircle(0, 0, rnd(15) + 5);
circle.graphics.endFill();
circle.x = rnd(1500);
circle.y = rnd(1500);
circle.z = rnd(100) * 20;
canvas.addChild(circle);
}
canvas.x = (500 - canvas.width) / 2;
canvas.y = (500 - canvas.height) / 2;
addChild(canvas);
this.addEventListener(Event.ENTER_FRAME, function(e:Event):void{
canvas.x = (0 - canvas.width + 500) / 500 * mouseX;
canvas.y = (0 - canvas.height + 500) / 500 * mouseY;
});
}
private function rnd(max:Number):Number{
return Math.floor(Math.random() * max);
}
}
}