大家好,我是奶綠茶
最近學生問起了一個 3D 的 Banner 效果要如何製作
寫了一個簡單的 Demo, 程式碼也很短,
只用到 TweenMax , 和 FlashPlayer10 的 3D 即可做到

import com.greensock.TweenMax;
var container:Sprite = new Sprite();
container.x = stage.stageWidth >> 1;
addChild( container );
addEventListener(Event.ENTER_FRAME , enterFrameHandler);
 
var back:MovieClip = new Back_mc;
back.x = stage.stageWidth >>1;
back.y = 40;
back.visible=false;
 
addChild( back );
 
back.addEventListener(MouseEvent.CLICK , function(){
showBack(false);
});
 
(function () {
for(var i:int = 0 ; i 90 ){
container.visible = false;
back.visible = true;
}
}
}else{
_update = function () {
if( container.rotationY < 90 ){
container.visible = true;
back.visible = false;
}
}
_onComplete = function () {
addEventListener(Event.ENTER_FRAME , enterFrameHandler);
}
 
}
TweenMax.to( container , .7 , {
rotationY:_targetV,
onUpdate:_update,
onComplete:_onComplete
});
TweenMax.to( back , .7 , { rotationY:_targetV });
}
 
function enterFrameHandler (e:Event):void {
var _value:Number = stage.stageWidth*.5 - mouseX;
_value *= 0.05;
container.rotationY += (_value - container.rotationY)/10;
}


SourceCode