flint
Happy New Year!
Click to party
Oh, and the code’s a mess.

source
package { import flash.events.MouseEvent; import org.flintparticles.common.actions.Age; import org.flintparticles.common.counters.Blast; import org.flintparticles.common.counters.Steady; import org.flintparticles.common.energyEasing.Quadratic; import org.flintparticles.common.events.EmitterEvent; import org.flintparticles.common.events.ParticleEvent; import org.flintparticles.common.initializers.Lifetime; import org.flintparticles.threeD.actions.Accelerate; import org.flintparticles.threeD.actions.LinearDrag; import org.flintparticles.threeD.actions.Move; import org.flintparticles.threeD.actions.RandomDrift; import org.flintparticles.threeD.emitters.Emitter3D; import org.flintparticles.threeD.geom.Vector3D; import org.flintparticles.threeD.initializers.Position; import org.flintparticles.threeD.initializers.Rotation; import org.flintparticles.threeD.initializers.ScaleAllInit; import org.flintparticles.threeD.initializers.Velocity; import org.flintparticles.threeD.papervision3d.PV3DRenderer; import org.flintparticles.threeD.papervision3d.initializers.PV3DObjectClasses; import org.flintparticles.threeD.particles.Particle3D; import org.flintparticles.threeD.zones.ConeZone; import org.flintparticles.threeD.zones.LineZone; import org.flintparticles.threeD.zones.PointZone; import org.flintparticles.threeD.zones.SphereZone; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.view.BasicView; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class HappyNewYear extends BasicView { private var flintRenderer:PV3DRenderer; private var rocket:Emitter3D; private var cameraTarget:DisplayObject3D = DisplayObject3D.ZERO; private var previousMouseX:Number = 0; private var cameraYaw:Number = 0; public function HappyNewYear() { flintRenderer = new PV3DRenderer( scene ); setupRocket(); startRendering(); stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_mouseMoveHandler); } private function setupRocket():void { rocket = new Emitter3D(); rocket.counter = new Steady( 1 ); rocket.addInitializer( new PV3DObjectClasses([HappyWord, NewWord, YearWord]) ); rocket.addInitializer( new ScaleAllInit(.9, 1.4)); rocket.addInitializer( new Position( new LineZone( new Vector3D( 0, -500, 0 ), new Vector3D( 0, -500, 0) ) ) ); rocket.addInitializer( new Velocity( new ConeZone( Vector3D.ZERO, Vector3D.AXISY, 1, 500, 330 ) ) ); rocket.addInitializer( new Lifetime( 3.3 ) ); rocket.addAction( new Age() ); rocket.addAction( new Move() ); rocket.addAction( new Accelerate( new Vector3D( 0, -50, 0 ) ) ); rocket.addAction( new LinearDrag( 0.5 ) ); rocket.addAction( new RandomDrift( 200, 200, 200 ) ); rocket.addEventListener( ParticleEvent.PARTICLE_DEAD, rocket_particleDeadHandler, false, 0, true ); flintRenderer.addEmitter(rocket); rocket.start(); } private function rocket_particleDeadHandler(event:ParticleEvent):void { var explode:Emitter3D = new Emitter3D(); explode.counter = new Blast( 10 ); explode.addInitializer( new PV3DObjectClasses([HappyWord, NewWord, YearWord]) ); explode.addInitializer( new ScaleAllInit(.3, .6)); explode.addInitializer( new Rotation(Vector3D.AXISX, 1, 360)); explode.addInitializer( new Rotation(Vector3D.AXISZ, 1, 360)); explode.addInitializer( new Position( new PointZone( Particle3D( event.particle ).position ) ) ); explode.addInitializer( new Velocity( new SphereZone( Vector3D.ZERO, 1000 ) ) ); explode.addInitializer( new Lifetime( 3 ) ); explode.addAction( new Age( Quadratic.easeIn ) ); explode.addAction( new Move() ); explode.addAction( new Accelerate( new Vector3D( 0, -500, 0 ) ) ); explode.addAction( new LinearDrag( 0.5 ) ); explode.addEventListener( EmitterEvent.EMITTER_EMPTY, explode_emitterEmptyHandler, false, 0, true ); flintRenderer.addEmitter( explode ); explode.start(); } private function explode_emitterEmptyHandler(event:EmitterEvent):void { Emitter3D( event.target ).removeEventListener( EmitterEvent.EMITTER_EMPTY, explode_emitterEmptyHandler ); flintRenderer.removeEmitter( Emitter3D( event.target ) ); } private function stage_mouseMoveHandler(event:MouseEvent):void { var differenceX:Number = event.stageX - previousMouseX; cameraYaw += differenceX; cameraYaw %= 360; previousMouseX = event.stageX; camera.orbit(90, cameraYaw, true, cameraTarget); } } } import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.typography.Text3D; import org.papervision3d.materials.special.Letter3DMaterial; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.core.geom.TriangleMesh3D; class HappyWord extends TriangleMesh3D { public function HappyWord() { super( null, new Array(), new Array(), null ); var word:Text3D = new Text3D("Happy", new HelveticaBold(), new Letter3DMaterial(0xfe5555)); addChild(word); } } import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.typography.Text3D; import org.papervision3d.materials.special.Letter3DMaterial; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.core.geom.TriangleMesh3D; class NewWord extends TriangleMesh3D { public function NewWord() { super( null, new Array(), new Array(), null ); var word:Text3D = new Text3D("New", new HelveticaBold(), new Letter3DMaterial(0x91c0ff)); addChild(word); } } import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.typography.Text3D; import org.papervision3d.materials.special.Letter3DMaterial; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.core.geom.TriangleMesh3D; import org.papervision3d.typography.fonts.HelveticaBold; class YearWord extends TriangleMesh3D { public function YearWord() { super( null, new Array(), new Array(), null ); var word:Text3D = new Text3D("Year", new HelveticaBold(), new Letter3DMaterial(0xfffbbb)); addChild(word); } }
Merry Christmas!
package { import flash.events.Event; import flash.filters.BlurFilter; import flash.geom.Point; import org.flintparticles.common.counters.Steady; import org.flintparticles.common.displayObjects.RadialDot; import org.flintparticles.common.initializers.ImageClass; import org.flintparticles.common.initializers.ScaleImageInit; import org.flintparticles.twoD.actions.DeathZone; import org.flintparticles.twoD.actions.Move; import org.flintparticles.twoD.actions.RandomDrift; import org.flintparticles.twoD.emitters.Emitter2D; import org.flintparticles.twoD.initializers.Position; import org.flintparticles.twoD.initializers.Velocity; import org.flintparticles.twoD.renderers.DisplayObjectRenderer; import org.flintparticles.twoD.zones.LineZone; import org.flintparticles.twoD.zones.PointZone; import org.flintparticles.twoD.zones.RectangleZone; import org.papervision3d.core.effects.view.ReflectionView; import org.papervision3d.materials.ColorMaterial; import org.papervision3d.materials.special.Letter3DMaterial; import org.papervision3d.objects.DisplayObject3D; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.typography.Text3D; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class MerryChristmas extends ReflectionView { private var pivotPoint:DisplayObject3D = new DisplayObject3D(); public function MerryChristmas() { viewportReflection.filters = [new BlurFilter(3,3,1)]; setReflectionColor(.5, .5, .5); surfaceHeight = -80; setupText(); setupSnow(); setupTree(); addEventListener(Event.ENTER_FRAME, enterFrameHandler); } private function setupText():void { var rockwell:Rockwell = new Rockwell(); var merryMaterial:Letter3DMaterial = new Letter3DMaterial(0xcc0000); var merry:Text3D = new Text3D("MERRY", rockwell, merryMaterial); var christmasMaterial:Letter3DMaterial = new Letter3DMaterial(0x00cc00); var christmas:Text3D = new Text3D("CHRISTMAS", rockwell, christmasMaterial); merry.z = -700; christmas.z = 500; christmas.rotationY = 180; pivotPoint.addChild(merry); pivotPoint.addChild(christmas); scene.addChild(pivotPoint); } private function setupTree():void { var radius:Number = 300; var height:Number = 500; var total:uint = 100; var looker:DisplayObject3D = new DisplayObject3D(); for(var i:int = 0; i < total; i++) { var material:ColorMaterial; if((i & 1) == 0) material = new ColorMaterial(0xaa0000); else material = new ColorMaterial(0x00aa00); material.doubleSided = true; var plane:Plane = new Plane(material, 30, 30, 1, 1); plane.x = Math.cos(i) * (radius - i * 3); plane.z = Math.sin(i) * (radius - i * 3); plane.y = i / total * height; looker.copyPosition(plane); looker.x = looker.z = 0; plane.lookAt(looker); pivotPoint.addChild(plane); } } private function setupSnow():void { var emitter:Emitter2D = new Emitter2D(); emitter.counter = new Steady(100); emitter.addInitializer(new ImageClass(RadialDot, 2)); emitter.addInitializer(new Position(new LineZone(new Point(-5,-5), new Point(645, -5)))); emitter.addInitializer(new Velocity(new PointZone(new Point(0, 65)))); emitter.addInitializer(new ScaleImageInit(0.75, 2)); emitter.addAction(new Move()); emitter.addAction(new DeathZone(new RectangleZone(-10, -10, 640, 250), true)); emitter.addAction(new RandomDrift(15, 15)); var flintRenderer:DisplayObjectRenderer = new DisplayObjectRenderer(); addChild(flintRenderer); flintRenderer.addEmitter(emitter); emitter.start(); } private function enterFrameHandler(event:Event):void { pivotPoint.rotationY += (viewport.containerSprite.mouseX - pivotPoint.rotationY) * .01; singleRender(); } } }
Flint Pixels 2 – Random Drift and Rotate Emitter
package { import flash.events.Event; import flash.filters.BlurFilter; import flash.filters.ColorMatrixFilter; import org.flintparticles.common.actions.Age; import org.flintparticles.common.counters.Steady; import org.flintparticles.common.initializers.ColorInit; import org.flintparticles.common.initializers.Lifetime; import org.flintparticles.threeD.actions.Move; import org.flintparticles.threeD.actions.RandomDrift; import org.flintparticles.threeD.activities.RotateEmitter; import org.flintparticles.threeD.emitters.Emitter3D; import org.flintparticles.threeD.geom.Vector3D; import org.flintparticles.threeD.initializers.Velocity; import org.flintparticles.threeD.papervision3d.PV3DPixelRenderer; import org.flintparticles.threeD.zones.DiscZone; import org.papervision3d.core.effects.BitmapLayerEffect; import org.papervision3d.core.geom.Pixels; import org.papervision3d.view.BasicView; import org.papervision3d.view.layer.BitmapEffectLayer; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class FlintPixels2 extends BasicView { private var emitter:Emitter3D; private var emitter2:Emitter3D; private var flintRenderer:PV3DPixelRenderer; private var bitmapEffectLayer:BitmapEffectLayer; private var pixels:Pixels; public function FlintPixels2() { camera.z = -300; setupPixels(); setupEmitter(); setupEmitter2(); setupFlintRenderer(); emitter.start(); emitter2.start(); startRendering(); } private function setupPixels():void { bitmapEffectLayer = new BitmapEffectLayer(viewport); viewport.containerSprite.addLayer( bitmapEffectLayer ); pixels = new Pixels(bitmapEffectLayer); bitmapEffectLayer.addDisplayObject3D(pixels); scene.addChild(pixels); bitmapEffectLayer.addEffect(new BitmapLayerEffect(new BlurFilter(2, 2, 1))); //@see http://livedocs.adobe.com/flex/3/langref/flash/filters/ColorMatrixFilter.html bitmapEffectLayer.addEffect(new BitmapLayerEffect(new ColorMatrixFilter([1.09,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]))); } private function setupEmitter():void { emitter = new Emitter3D(); emitter.counter = new Steady(500); emitter.position.x = -150; emitter.addInitializer(new ColorInit(0xffcccc00, 0xffffffff)); emitter.addInitializer(new Velocity(new DiscZone(new Vector3D(340, 0, 0), new Vector3D(0, 1, 0), 100, 100))); emitter.addInitializer(new Lifetime(4)); emitter.addAction(new Move()); emitter.addAction(new Age()); emitter.addAction(new RandomDrift(3000, 3000, 3000)); emitter.addActivity(new RotateEmitter(new Vector3D(.1, .3, 0))); } private function setupEmitter2():void { emitter2 = new Emitter3D(); emitter2.counter = new Steady(500); emitter2.position.x = 150; emitter2.addInitializer(new ColorInit(0xffcccc00, 0xffffffff)); emitter2.addInitializer(new Velocity(new DiscZone(new Vector3D(-340, 0, 0), new Vector3D(0, 1, 0), 100, 100))); emitter2.addInitializer(new Lifetime(4)); emitter2.addAction(new Move()); emitter2.addAction(new Age()); emitter2.addAction(new RandomDrift(3000, 3000, 3000)); emitter2.addActivity(new RotateEmitter(new Vector3D(.1, -.3, 0))); } private function setupFlintRenderer():void { flintRenderer = new PV3DPixelRenderer(pixels); flintRenderer.addEmitter(emitter); flintRenderer.addEmitter(emitter2); } override protected function onRenderTick(event:Event = null):void { renderer.renderScene(scene, camera, viewport); } } }
Flint Pixels
package { import flash.events.Event; import flash.filters.BlurFilter; import org.flintparticles.common.actions.Age; import org.flintparticles.common.counters.Steady; import org.flintparticles.common.initializers.ColorInit; import org.flintparticles.common.initializers.Lifetime; import org.flintparticles.threeD.actions.Accelerate; import org.flintparticles.threeD.actions.Move; import org.flintparticles.threeD.emitters.Emitter3D; import org.flintparticles.threeD.geom.Vector3D; import org.flintparticles.threeD.initializers.Velocity; import org.flintparticles.threeD.papervision3d.PV3DPixelRenderer; import org.flintparticles.threeD.zones.DiscZone; import org.papervision3d.core.effects.BitmapLayerEffect; import org.papervision3d.core.geom.Pixels; import org.papervision3d.view.BasicView; import org.papervision3d.view.layer.BitmapEffectLayer; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class FlintPixels extends BasicView { private var emitter:Emitter3D; private var flintRenderer:PV3DPixelRenderer; private var bitmapEffectLayer:BitmapEffectLayer; private var pixels:Pixels; public function FlintPixels() { camera.z = -300; setupPixels(); setupEmitter(); setupFlintRenderer(); emitter.start(); startRendering(); } private function setupPixels():void { bitmapEffectLayer = new BitmapEffectLayer(viewport); viewport.containerSprite.addLayer( bitmapEffectLayer ); pixels = new Pixels(bitmapEffectLayer); bitmapEffectLayer.addDisplayObject3D(pixels); scene.addChild(pixels); bitmapEffectLayer.addEffect(new BitmapLayerEffect(new BlurFilter(2, 2, 1))); } private function setupEmitter():void { emitter = new Emitter3D(); emitter.counter = new Steady( 500 ); emitter.addInitializer(new ColorInit(0xffcc0000, 0xffffffff)); emitter.addInitializer(new Velocity(new DiscZone(new Vector3D(0, 340, 0), new Vector3D(0, 1, 0), 100, 100))); emitter.addInitializer(new Lifetime(3)); emitter.addAction(new Move()); emitter.addAction(new Accelerate(new Vector3D(0, -300, 0))); emitter.addAction(new Age()); } private function setupFlintRenderer():void { flintRenderer = new PV3DPixelRenderer(pixels); flintRenderer.addEmitter(emitter); } override protected function onRenderTick(event:Event = null):void { pixels.rotationY += (viewport.containerSprite.mouseX - pixels.rotationY) * .3; pixels.rotationX += (viewport.containerSprite.mouseY - pixels.rotationX) * .3; renderer.renderScene(scene, camera, viewport); } } }
Search
Recommended Books
Speaking at FITC Toronto
Recent Posts
- Moving to johnlindquist.com
- AsyncCommand with Robotlegs, Signals, Flight, MinimalComps
- Search Widget – Robotlegs, Signals, Flight, Minimal Comps, Yahoo Astra
- FDT Super Awesome March Deal
- FDT Theme Designer
- haXe Tutorial
- AS3 Signals Tutorial
- Preferred Video Tutorial Resolution?
- TweenMax – Tweening a timeline (Advanced Tweening)
- Robotlegs + Flight + Union Platform
- Back in the saddle
- Eclipse Theme Designer Preview
- RobotLegs Hello World Video Tutorial
- 10 Things Every Senior Flash Developer Should Know
- Efflex – 3D Effects for Flex
Recent Comments
- شقق للبيع في الاردن on Moving to johnlindquist.com
- Annakhan006 on Augmented Reality – Recursive Webcam
- Yarout on Augmented Reality – Recursive Webcam
- Vivon on about
- Josh @ Wall Stickers on Moving to johnlindquist.com
- list of lpn courses on SpringCamera3D and Driving a Car
- rn to bsn in montgomery al on archive
- PowerPoint Recovery on Eclipse Theme Designer Preview
- cheat mw3 on Test if a plane is within the view of the camera (aka testing if culled)
- Goa Hotels on Looking around the inside of a Sphere
Categories
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « May | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
Archives
Preferred Video Tutorial Resolution
- 1024x768 (53%, 85 Votes)
- 1280x1024 (15%, 24 Votes)
- 1920x1080 (15%, 24 Votes)
- 800x600 (13%, 20 Votes)
- 480x320 (4%, 6 Votes)
- 640x480 (0%, 2 Votes)
Total Voters: 160


