flash on 2011-11-24
...
@author Charlie Schulze, charlie[at]woveninteractive[dot]com
♥0 |
Line 43 |
Modified 2011-11-26 20:48:40 |
MIT License
archived:2017-03-20 10:12:11
ActionScript3 source code
/**
* Copyright wcssoft ( http://wonderfl.net/user/wcssoft )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vzrz
*/
package
{
import flash.display.DisplayObject;
import flash.display.AVM1Movie;
import flash.events.Event;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.core.effects.view.ReflectionView;
/**
* ...
* @author Charlie Schulze, charlie[at]woveninteractive[dot]com
*/
public class Main extends ReflectionView
{
protected var plane:Plane;
protected var colorMaterial:ColorMaterial;
protected var numofPlanes:Number = 10;
protected var angle:Number;
protected var radius:Number=400;
protected var container:DisplayObject3D;
public function Main():void
{
super();
//Create one material and make it doublesided
colorMaterial = new ColorMaterial(0xFF0000, .5);
colorMaterial.doubleSided = true;
container = new DisplayObject3D();
//Create a plane using the colorMaterial
for (var i:int = 0; i < numofPlanes; i++)
{
plane = new Plane(colorMaterial, 100, 100);
scene.addChild(container);
container.addChild(plane);
angle=(Math.PI * 2)/numofPlanes * i;
plane.x = Math.cos(angle)*radius;
plane.z = Math.sin(angle)*radius;
//please explain this line
plane.rotationY = -360 / numofPlanes * i -90;
}
//container.roll(60);
//Start the rendering
startRendering();
}
override protected function onRenderTick(event:Event = null):void
{
super.onRenderTick(event);
container.rotationY = -((mouseX / stage.stageWidth) * 360) //Rotation
//container.rotationX = -((mouseY / stage.stageHeight) * 360)*0.5 //Rotation
//Rotate the plane
// container.yaw(2);
}
}
}