/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { import away3d.materials.utils.CubeMap; import com.greensock.TweenMax; import flash.display.BitmapData; import flash.display.Sprite; public class AnimatedCubeMap { private var __cubeMap:CubeMap; private var __faceTop:AnimatedCubeMapFace; private var __faceBottom:AnimatedCubeMapFace; private var __faceFront:AnimatedCubeMapFace; private var __faceRear:AnimatedCubeMapFace; private var __faceLeft:AnimatedCubeMapFace; private var __faceRight:AnimatedCubeMapFace; public function get cubeMap():CubeMap { __cubeMap = new CubeMap(__faceRight.snapshot, __faceLeft.snapshot, __faceTop.snapshot, __faceBottom.snapshot, __faceRear.snapshot, __faceFront.snapshot); // __cubeMap.positiveX = __faceRight.snapshot; // __cubeMap.negativeX = __faceLeft.snapshot; // // __cubeMap.positiveY = __faceTop.snapshot; // __cubeMap.negativeY = __faceBottom.snapshot; // // __cubeMap.positiveZ = __faceRear.snapshot; // __cubeMap.negativeZ = __faceFront.snapshot; return __cubeMap; } public function AnimatedCubeMap() { init(); } private function init():void { initCubeMap(); initFaces(); } private function initCubeMap():void { __cubeMap = new CubeMap(); } private function initFaces():void { __faceTop = new AnimatedCubeMapFace(new cubemap2_top(), new cubemap1_top()); __faceBottom = new AnimatedCubeMapFace(new cubemap2_bottom(), new cubemap1_bottom()); __faceFront = new AnimatedCubeMapFace(new cubemap2_front(), new cubemap1_front()); __faceRear = new AnimatedCubeMapFace(new cubemap2_rear(), new cubemap1_rear()); __faceLeft = new AnimatedCubeMapFace(new cubemap2_left(), new cubemap1_left()); __faceRight = new AnimatedCubeMapFace(new cubemap2_right(), new cubemap1_right()); } } }