Here is another experiment in proximity with Papervision3D. This is essentially the exact reverse of the previous example. This time I am using the new Adobe AIR logo by way of a BitmapAssetMaterial. Now the planes are aligned properly unless your mouse gets too close. Happy Thanksgiving!
Actionscript:
- import org.papervision3d.scenes.*;
- import org.papervision3d.cameras.*;
- import org.papervision3d.objects.*;
- import org.papervision3d.materials.*;
- import caurina.transitions.*;
-
- // Create the container sprite
- var con:Sprite = new Sprite();
- con.x = stage.stageWidth * 0.5 - 250;
- con.y = stage.stageHeight * 0.5 + 250;
- addChild(con);
-
- // Setup the scene
- var scene:Scene3D = new Scene3D(con);
- var cam:Camera3D = new Camera3D();
- cam.zoom = 11;
-
- // Create the planes
- var pa:Array = new Array();
- for(var i:uint=0; i<10; i++)
- {
- for(var j:uint=0; j<10; j++)
- {
- var cm:BitmapAssetMaterial = new BitmapAssetMaterial("air");
- cm.oneSide = false;
- var p:Plane = new Plane(cm, 50, 50);
- p.x = j * 50 + 25;
- p.y = i * 50 + 25;
- scene.addChild(p);
- pa.push({pl:p, rotY:Math.random() * 360, rotZ:Math.random() * 360, z:Math.random() * 30000});
- p.rotationY = pa[i].rotY;
- p.rotationZ = pa[i].rotZ;
- p.z = pa[i].z;
- }
- }
-
- // Create the render loop
- addEventListener(Event.ENTER_FRAME, render);
-
- function render(e:Event):void
- {
- for(var i:uint; i<pa .length; i++)
- {
- if(checkDist(pa[i].pl))
- {
- Tweener.addTween(pa[i].pl, {rotationY:0, rotationZ:0, z:0, time:0.3});
- }
- else
- {
- Tweener.addTween(pa[i].pl, {rotationY:pa[i].rotY, rotationZ:pa[i].rotZ, z:pa[i].z, time:3});
- }
- }
- scene.renderCamera(cam);
- }
-
- function checkDist(p:Plane):Boolean
- {
- var p1:Point = new Point(p.x, p.y);
- var p2:Point = new Point(con.mouseX, -con.mouseY);
- if(Point.distance(p1, p2)> 150)
- {
- return true;
- }
- else return false;
- }
flex version:
Flex-App:
http://labs.vizar.de/papergrid/
Source:
http://labs.vizar.de/papergrid/srcview/

