ActionScript 3 AS3 3D图库 - 屏幕到屏幕效果
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3 3D图库 - 屏幕到屏幕效果相关的知识,希望对你有一定的参考价值。
import com.greensock.*;
import com.greensock.easing.*;
var lastRotX = 0;
var lastRotY = 0;
for(var i=0; i<gal.numChildren; i++){
var self = gal.getChildAt(i);
self.addEventListener(MouseEvent.CLICK,windowClicked);
}
addEventListener(Event.ENTER_FRAME,loop);
function windowClicked(e){
var self = e.currentTarget;
removeEventListener(Event.ENTER_FRAME,loop);
var timeline = new TimelineLite();
var transition = new TimelineLite();
timeline.insert(TweenLite.to(gal,1,{x:(self.x)*-1,y:(self.y)*-1, z:-1210, ease: Sine.easeInOut}));
timeline.insert(transition);
lastRotX = gal.rotationX;
lastRotY = gal.rotationY;
var oppRotX = gal.rotationX*-1;
var oppRotY = gal.rotationY*-1;
transition.append(TweenLite.to(gal,0.5,{rotationX:oppRotX*7,rotationY:oppRotY*7, ease: Sine.easeOut}));
transition.append(TweenLite.to(gal,0.5,{rotationX:0,rotationY:0, ease: Sine.easeIn}));
self.removeEventListener(MouseEvent.CLICK,windowClicked);
self.addEventListener(MouseEvent.CLICK,zoomOut);
}
function zoomOut(e){
var self = e.currentTarget;
self.addEventListener(MouseEvent.CLICK,windowClicked);
var timeline = new TimelineLite();
var transition = new TimelineLite({onComplete:function(){ addEventListener(Event.ENTER_FRAME,loop) }});
timeline.insert(TweenLite.to(gal,1,{x:573,y:422, z:0, ease: Sine.easeOut}));
timeline.insert(transition);
transition.append(TweenLite.to(gal,0.5,{rotationX:lastRotX*7,rotationY:lastRotY*7, ease: Sine.easeOut}));
transition.append(TweenLite.to(gal,0.5,{rotationX:0,rotationY:0, ease:Sine.easeInOut}));
}
function loop(e){
var distx:Number = mouseX / 650;
var disty:Number = mouseY / 450;
TweenLite.to(gal, 2, {
rotationY:(-70 + (140*distx))*0.06,
rotationX:(70 - (140*disty))*0.06,
ease:Expo.easeOut
});
}
以上是关于ActionScript 3 AS3 3D图库 - 屏幕到屏幕效果的主要内容,如果未能解决你的问题,请参考以下文章
ActionScript 3 Flash画廊效果中的AS3 3D旋转螺旋
ActionScript 3 使用AS3和Tweenlite进行简单的3D 360旋转悬停效果
带Flash/Actionscript 3的3D翻转效果
ActionScript 3 AS3 SWFtrospection(as3swf)
ActionScript 3 AS3 TextField和StyleSheet示例(在ActionScript中创建)
[ActionScript 3.0] AS3.0 水面波纹效果