2021-09-11 来源:网络
sh AS3.0教程:仿真3D的元件移动效果
仿真3D的元件移动效果动画预览如下:
步骤一、新建“背景”图层,在图层中设计场景动画的基本内容,本例加入的是山脉移动的影片剪辑;
步骤二、新建“飞碟”图层,加了2个飞碟影片剪辑“cira_mc”、“cirb_mc”,以及1个十字中心点影片剪辑“center_mc”。影片剪辑“center_mc”的位置将成为飞碟3D移动效果的中心点。
步骤三、新增“文稿”图层,选择第1帧,按F9打开动作面板;
步骤四、在动作面板中编写场景舞台的帧切换事件以及对应的监听函数cir_move();
Flash AS3.0教程(仿真3D的元件移动效果)Acitoin Scirpt代码如下:
var radius = 100;
var degrees = 0;
var perspective = 150;
addEventListener("enterFrame",cir_move);
function cir_move(me:Event){
center_mc.visible=false;
angle = degrees * 0.0174533;
degrees = degrees + 2;
xposition = radius * Math.cos(angle);
yposition = radius * Math.sin(angle);
zposition = radius * Math.sin(angle);
distance = 1 / (1 - zposition / perspective);
cirb_mc.x = xposition * distance + center_mc.x;
cirb_mc.y = center_mc.y;
cirb_mc.scaleX = distance;
cirb_mc.scaleY = distance;
cira_mc.x = center_mc.x;
cira_mc.y = yposition * distance + center_mc.y;
cira_mc.scaleX = distance;
cira_mc.scaleY = distance;
}
这样,Flash AS3.0教程:仿真3D的元件移动效果的动画就制作完成了,快下载源码试试吧。
相关文章