lighting ball
import flash.display.BitmapData;
import flash.display.Bitmap;
/**
* Copyright ysle ( http://wonderfl.net/user/ysle )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bJbO
*/
package
{
import away3d.containers.View3D;
import away3d.core.math.Vector3DUtils;
import away3d.debug.AwayStats;
import away3d.entities.SegmentSet;
import away3d.primitives.LineSegment;
import flash.events.Event;
import flash.geom.Vector3D;
//import flash.display.BitmapData;
//import flash.display.Bitmap;
[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]
public class Main extends View3D
{
private var lines:SegmentSet;
//private var source:BitmapData = new BitmapData(465, 465, false, 0x000000);
public function Main():void
{
stage.scaleMode = 'noScale'
stage.align = 'TL'
Wonderfl.disable_capture();
//addChild(new Bitmap(source));
addChild(new AwayStats(this))
scene.addChild(lines = new SegmentSet())
var point:Vector3D = new Vector3D(0, 0, 400)
var origo:Vector3D = new Vector3D()
for (var i:int = 0; i < 1000; i++) lines.addSegment(
new LineSegment(
origo,
Vector3DUtils.rotatePoint(
point,
new Vector3D(Math.random() * 100, Math.random() * 100, 0)
),
0xff,
0x22,
10
)
)
stage.addEventListener(Event.RESIZE, onStageResize)
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame)
onStageResize()
}
private function onEnterFrame(e:Event):void
{
lines.rotationX +=2
lines.rotationY --
render()
//renderer.queueSnapshot(source)
}
private function onStageResize(e:Event = null):void
{
width = stage.stageWidth
height = stage.stageHeight
}
}
}