/ Published in: ActionScript 3
Control your objects via mouse similar to AirtightInteractive's TiltViewer
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var ShiftY: Number = stage.stageWidth / 2; var ShiftX: Number = stage.stageHeight / 2; // number @ the end (90) is the degree's to allow object to turn var rotationY: Number = -( (mouseX - ShiftY) / stage.stageWidth * 90); var rotationX: Number = -( (mouseY - ShiftX) / stage.stageHeight * 90); // Replace _screenCube with the object you wish to control // Lower number = faster turns _screenCube.rotationY += (-rotationY - _screenCube.rotationY) / 12; _screenCube.rotationX += (rotationX - _screenCube.rotationX) / 12;
URL: http://www.destroyyourcomputer.com