flash on 2011-3-27
♥0 |
Line 35 |
Modified 2011-03-27 22:50:48 |
MIT License
archived:2017-03-20 14:55:08
ActionScript3 source code
/**
* Copyright yasnis ( http://wonderfl.net/user/yasnis )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6wez
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.text.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.cameras.*;
import org.papervision3d.core.effects.view.ReflectionView;
[SWF(frameRate = "60", backgroundColor = "0x001122")]
public class Main extends ReflectionView {
public function Main()
{
super(0, 0, true , false, CameraType.TARGET);
camera.zoom = 1.5;
camera.focus = 200;
// refrection
surfaceHeight = 0;
viewportReflection.alpha = .5;
var planeB:Plane = new Plane(null, 4000, 4000, 6, 6);
planeB.pitch(90)
scene.addChild(planeB);
var p:Plane = new Plane(null,400,400);
p.y = 300;
scene.addChild(p);
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
Wonderfl.capture(stage);
}
private function enterFrameHandler(event:Event):void
{
camera.x += (2000 * Math.sin(mouseX / stage.stageWidth * 180 * Math.PI / 180) - camera.x) * .1;
//camera.z += (2000 * Math.cos(mouseX / stage.stageWidth * 360 * Math.PI / 360) - camera.z) * .1;
camera.y += (2000 * mouseY / stage.stageHeight - camera.y) * .10;
singleRender();
}
}
}