网友俱乐部 » » Director教程 » Director制作立体画面动画特效

2008-4-15 08:52 lonjew
Director制作立体画面动画特效

本节创建一个长方体画面的实例。该实例使一个立体随着鼠标的移动而产生旋转变化。  
         立体画面动画制作操作步骤如下:  
(1) 启动Director 8.5。执行Modify→Movie→Properties命令,在弹出的舞台属性检查器对话框中将电影舞台的大小设置为450×450,将背景颜色设置为黑色,如图8-19所示。  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164022911.jpg[/img]
  
图8-19  设置舞台的属性  
(2) 按Ctrl R组合键,导入6张图片到Cast窗口中,如图8-20所示。  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164025873.jpg[/img]
  
图8-20  导入图片  
(3) 将Cast演员逐一拖动到舞台上,生成6个精灵,如图8-21所示。  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164025272.jpg[/img]
  
图8-21  生成精灵  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164028154.gif[/img]
















(4) 在工作窗口单击工具栏上的Script按钮
[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164029898.jpg[/img]
,在弹出的Script窗口中,设置Lingo语句如下,如图8-22所示。  
:global allcorners  
global pCenter  
global Rlist  
global gRotate  
global Planeangle  
   
on startMovie  
  initbox  
end  
(5) 在initbox函数中,设置以下Lingo语句,如图8-23所示。  
on initbox  
allcorners=,,,,,  
,,,,]  
  pCenter=point(200,175)  
  Rlist=,,,,,]  
end  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164029682.jpg[/img]
  
图8-23  Initbox句柄  
(6) 设置framescript句柄,输入Lingo控制语句如下,如图8-24所示。  
on framescript  
  gRotate=gRotate-(float(the mouseH-320)/30)*pi()/100  
  Planeangle=-(float(the mouseV-240)/30)*pi()/20  
  drawsides  
end  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164030711.jpg[/img]
  
图8-24  framescript句柄  
(7) 在Script窗口输入以下drawsides函数中的Lingo控制语句,如图8-25所示。  
on drawsides  
  list=  
  repeat with i = 1 to count(allcorners)  
    temp=plotPoint(allcorners)  
    add list,temp  
  end repeat  
   
  quadlist=  
  repeat with i =1 to count(Rlist)  
    thisRect=Rlist  
    q=],list],list],list]]  
    z=],list],list],list]]  
      
    addprop quadlist,z,q  
  end repeat  
  sort quadlist  
  repeat with i =1 to count(Rlist)  
    sprite(i).quad=quadlist  
  end repeat  
end  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164031727.jpg[/img]
  
图8-25  drawsides句柄  
(8) 在Script窗口输入以下plotPoint函数中的Lingo控制语句,如图8-26所示。  
on plotPoint objectInfo  
  x= getAt(objectInfo,1)  
  y=getAt(objectInfo,2)  
  z= getAt(objectInfo,3)  
  radius=sqrt(x*x y*y)  
  if x=0.0 then angle = atan(the maxinteger)  
  else angle = atan(float(y)/x)  
  if y<0 then angle =angle pi()  
  set angle =angle  gRotate  
  realX=radius*cos(angle)  
  realZ=radius*sin(angle)  
  realY=z  
  radus=sqrt(realY*realY realZ*realZ)  
  if realZ = 0 then angle =atan(the maxInteger)  
  else angle=(atan(realY/realZ))  
  if realZ<0 then angle =angle  pi()  
  angle = angle -Planeangle  
  screenX=realX  
  screenY=radius*sin(angle)  
  screenZ=radius*cos(angle)  
  return   
end  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164031825.jpg[/img]
  
图8-26  plotPoint句柄  
(9) 在Score窗口的Script通道中,双击第1帧。在弹出的Script窗口中,加入以下的Lingo控制语句,如图8-27所示。  
on exitFrame me  
  framescript  
  go to the frame  
end  
(10) 至此,立体画面动画的制作完成了,播放效果如图8-28所示。  

[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164032216.jpg[/img]
                  
[img]http://media.chinaitlab.com/UploadFiles_3014/200608/20060812164032729.jpg[/img]

图8-27  第1帧的Lingo脚本                    图8-28  立体画面播放效果

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.