I've been using it for a project for a few weeks now and have found it great to work with. I've even started porting parts of Away3D to the haXe Lite version with no trouble (for example the Morhper - http://blog.touchmypixel.com/2010/02/away3dlite-haxe-morphing/). Dam site faster than Away3D too!
On Mar 4, 10:07 am, Justin Lawerance Mills <[email protected]> wrote: > Charles > > Away3Dlite examples are in the > svn...http://code.google.com/p/away3d/source/browse/#svn/trunk/haxe/Examples/ > Away3DLite-dbg/src > > I have started experimenting and the examples are easy to rework to > your needs (http://www.justinfront.net/clients/studyo54/CarouselTest.swf > ) but yet to feed it images or do anything interesting with it > ( drag round ) source is below, but its very similar to the examples > in svn. > > if you can't use flash10, sandy3D is another option that I suspect is > slower (?), but sandy is more cross target and I have used it > commercially, both engines seem to compromise in terms of haXe as they > rely on inheritance which is less suitable for cross target and also > suffer not being able to override native properties, so 'x' becomes > '_x' in away3dlite. > > But I would suggest diving in. > > Cheers > > Justin > > _____________________________________________ > -swf9 CarouselTest.swf > -swf-version 10 > -swf-header 800:600:30:ffffff > -main CarouselTest > > package; > import away3dlite.cameras.HoverCamera3D; > import away3dlite.containers.Scene3D; > import away3dlite.containers.View3D; > import away3dlite.core.base.Mesh; > import away3dlite.containers.ObjectContainer3D; > import away3dlite.core.base.SortType; > import away3dlite.core.render.BasicRenderer; > import away3dlite.core.render.Renderer; > import away3dlite.events.MouseEvent3D; > import away3dlite.materials.WireColorMaterial; > import away3dlite.primitives.Plane; > import flash.display.Bitmap; > import flash.display.Sprite; > import flash.events.Event; > import flash.events.MouseEvent; > import flash.Lib; > import net.hires.debug.Stats; > import flash.display.StageQuality; > > class CarouselTest extends Sprite > { > // JLM at justinfront dot net > > //engine variables > private var scene: Scene3D; > private var camera: HoverCamera3D; > private var renderer: Renderer; > private var view: View3D; > > //navigation variables > private var move: Bool; > private var lastPanAngle: Float; > private var lastTiltAngle: Float; > private var lastMouseX: Float; > private var lastMouseY: Float; > > private var _planes: Array<Plane>; > private var _centre: ObjectContainer3D; > private var _thetas: Array<Float>; > private var _left_mc: Sprite; > private var _right_mc: Sprite; > private var _goRight: Bool; > private var _currRot: Float; > > public static function main(){ Lib.current.addChild( new > CarouselTest() ); } > public function new() > { > super(); > > move = false; > > if (stage != null) init(); > addEventListener( Event.ADDED_TO_STAGE, init ); > > } > > private function createArrows() > { > > _left_mc = new Sprite(); > _left_mc.x = 10; > _left_mc.y = 580; > > Lib.current.addChild( _left_mc ); > > _left_mc.graphics.lineStyle( 0, 0x666666, 1 ); > _left_mc.graphics.beginFill( 0x666666, 1 ); > _left_mc.graphics.moveTo( 16, 2 ); > _left_mc.graphics.lineTo( 5, 8 ); > _left_mc.graphics.lineTo( 16, 14 ); > _left_mc.graphics.endFill(); > > _left_mc.addEventListener( MouseEvent.MOUSE_DOWN, goLeft ); > > _right_mc = new Sprite(); > _right_mc.x = 780; > _right_mc.y = 580; > > Lib.current.addChild( _right_mc ); > > _right_mc.graphics.lineStyle( 0, 0x666666, 1 ); > _right_mc.graphics.beginFill( 0x666666, 1 ); > _right_mc.graphics.moveTo( 5, 2 ); > _right_mc.graphics.lineTo( 16, 8 ); > _right_mc.graphics.lineTo( 5, 14 ); > _right_mc.graphics.endFill(); > > _right_mc.addEventListener( MouseEvent.MOUSE_DOWN, goRight ); > > } > > private function goLeft( e: Event ) > { > _goRight = false; > } > > private function goRight( e: Event ) > { > _goRight = true; > } > > private function init( ?e: Event ):Void > { > > createArrows(); > initEngine(); > initObjects(); > initListeners(); > > } > > private function initEngine():Void > { > > scene = new Scene3D(); > > camera = new HoverCamera3D(); > camera.focus = 20; > camera.distance = 400; > camera.minTiltAngle = -30; > camera.maxTiltAngle = 30; > > camera.hover( true ); > > renderer = new BasicRenderer(); > view = new View3D(); > view.scene = scene; > view.camera = camera; > view.renderer = renderer; > addChild( view ); > addChild( new Stats() ); > } > > private function initObjects():Void > { > > _centre = new ObjectContainer3D(); > _centre.z -= 720; > > scene.addChild( _centre ); > > var aPlane: Plane; > var no: Int = 30; > var theta: Float; > var rH: Int = 1000; > var rW: Int = 1200; > > _planes = new Array(); > _thetas = new Array(); > > for( i in 0...no ) > { > aPlane = new Plane(); > theta = i*(2*Math.PI)/50; > > aPlane.x = rW*Math.sin( theta ); > aPlane.y = 0; > aPlane.z = rH*Math.cos( theta ); > > aPlane._width = 200; > aPlane._height = 160; > > aPlane.rotationX = -90; > aPlane.segmentsW = 4; > aPlane.segmentsH = 3; > > _centre.addChild( aPlane ); > _planes.push( aPlane ); > _thetas.push( theta ); > } > > _currRot = 0; > > } > > /** > * Initialise the listeners > */ > private function initListeners():Void > { > > scene.addEventListener( MouseEvent3D.MOUSE_UP, > onSceneMouseUp ); > > addEventListener( Event.ENTER_FRAME, > onEnterFrame ); > stage.addEventListener( MouseEvent.MOUSE_DOWN, > onMouseDown ); > stage.addEventListener( MouseEvent.MOUSE_UP, > onMouseUp ); > stage.addEventListener( Event.RESIZE, > onResize ); > > onResize(); > > } > > /** > * Mouse up listener for the 3d scene > */ > private function onSceneMouseUp( e: MouseEvent3D ):Void > { > if (Std.is(e.object, Mesh)) { > var mesh:Mesh = Lib.as(e.object, Mesh); > mesh.material = new WireColorMaterial(); > } > } > > /** > * Navigation and render loop > */ > private function onEnterFrame( event: Event ):Void > { > > if( move ) > { > > camera.panAngle = 0.3*( stage.mouseX - lastMouseX ) + > lastPanAngle; > camera.tiltAngle = 0.3*( stage.mouseY - lastMouseY ) + > lastTiltAngle; > > } > > camera.hover(); > > var theta: Float = 0; > var rH: Int = 1000; > var rW: Int = 1200; > var thetaItter = _thetas.iterator(); > > if( _goRight ) > { > > _currRot -= 0.05*Math.PI*2/50; > > } > else > { > > _currRot += 0.05*Math.PI*2/50; > > } > > var aplane: Plane = new Plane(); > var i: Int = 0; > > for( aPlane in _planes ) > { > > theta = _thetas[i++] + _currRot; > aPlane.x = rW*Math.sin( theta ); > aPlane.z = rH*Math.cos( theta ); > aplane = aPlane; > > } > > if( _goRight ) > { > if( Math.round( Math.sin( _thetas[ 0 ] + _currRot - > Math.PI/2 )*1000 ) > Math.round( Math.sin( _thetas[ _thetas.length - > 3 ] + _currRot - Math.PI/2 )*1000 ) ) > { > > bottomToTop(); > > } > } > else > { > if( Math.round( Math.sin( _thetas[ 2 ]+_currRot + > Math.PI/2)*1000 ) > > Math.round( Math.sin( _thetas[ _thetas.length-1 ] + _currRot + Math.PI/ > 2 )*1000 ) ) > { > > topToBottom(); > > } > } > > view.render(); > > } > > /** > * Mouse down listener for navigation > */ > private function onMouseDown( event: MouseEvent ):Void > { > > lastPanAngle = camera.panAngle; > lastTiltAngle = camera.tiltAngle; > lastMouseX = stage.mouseX; > lastMouseY = stage.mouseY; > move = true; > > stage.addEventListener( Event.MOUSE_LEAVE, onStageMouseLeave ); > > } > > private function shiftPush( arr: Array<Dynamic> ):Void > { > > arr.push( arr.shift() ); > > } > > private function unshiftPop( arr: Array<Dynamic> ):Void > { > > arr.unshift( arr.pop() ); > > } > > private function topToBottom() > { > > var temp = _thetas[ 0 ]; > > unshiftPop( _thetas ); > > _thetas[ 0 ] = temp - (2*Math.PI)/50; > unshiftPop( _planes ); > > } > > private function bottomToTop() > { > > var temp = _thetas[ _thetas.length - > 1 ]; > > shiftPush( _thetas ); > > _thetas[ _thetas.length - 1 ] = temp + (2*Math.PI)/50; > shiftPush( _planes ); > > } > > /** > * Mouse up listener for navigation > */ > private function onMouseUp( event: MouseEvent ):Void > { > > move = false; > stage.removeEventListener(Event.MOUSE_LEAVE, > onStageMouseLeave); > > } > > /** > * Mouse stage leave listener for navigation > */ > private function onStageMouseLeave( event: Event ):Void > { > > move = false; > stage.removeEventListener( Event.MOUSE_LEAVE, > onStageMouseLeave ); > > } > > /** > * Stage listener for resize events > */ > private function onResize( ?event: Event ):Void > { > > view.x = stage.stageWidth / 2; > view.y = stage.stageHeight / 2; > > } > > } > > On 3 Mar 2010, at 21:56, Charles Iliya Krempeaux ... > > read more »
