| 碰撞动画特效制作
本实例演示一次空难事故的发生过程,通过本实例学习如何控制精灵的大小、位置、旋转和颜色。
碰撞动画制作操作步骤如下:
(1) 进入Director 8.5。执行Modify→Movie→Properties命令,在舞台属性检查器对话框中将电影舞台的大小设置为640×480,然后将电影背景颜色设置为白色,如图7-25所示。

图7-25 设置舞台属性
(2) 执行File→Import命令,调入本书光盘中的Colud017、155.jpg、3043.jpg文件,然后将Internal Cast窗口中的演员拖动到舞台中并调整大小,如图7-26所示。

图7-26 精灵的放置位置
(3) 执行Window→Score命令,调整3个精灵的开始帧为第1帧,终止帧为第4帧,如图7-27所示。

图7-27 设置精灵的帧数
(4) 执行Window→Text命令,打开Text窗口,输入“点背!”然后设置字体和字号,如图7-28所示。再将该演员拖动到通道4中的第4帧位置,并在舞台上调整位置。

图7-28 输入文本
(5) 在Score窗口的Script通道中双击第2帧,在弹出的Script窗口中,输入以下Lingo控制语句,如图7-29所示。
on exitFrame me
set Vloc3 = the locV of sprite 3
set Hloc2 = the locH of sprite 2
set HT3 = the height of sprite 3
set WD3 = the width of sprite 3
repeat with i = 1 to 10
set the skew of sprite 2 =i*5–30
set the locH of sprite 2 = Hloc2–i*12
set the locV of sprite 3 =Vloc3+i*10
set the height of sprite 3 =HT3+i*3
set the Width of sprite 3 =WD3+i*3
set the rotation of sprite 3 = i * 36
waita
updatestage
end repeat
repeat with i = 1 to 10
set the skew of sprite 2 =–i*2
waitb
updatestage
end repeat
end
on waita
repeat with n =1 to 80000
end repeat
end
on waitb
repeat with n =1 to 10000
end repeat
end
说明:
其中waita和waitb句柄设置了时间延迟。

图7-29 第2帧位置的Lingo脚本
(6) 在Score窗口的Script通道中双击第3帧,在弹出的Script窗口中,输入以下Lingo控制语句,如图7-30所示。
on exitFrame me
repeat with i =1 to 8
set the rotation of sprite 2 =–i * 10
updatestage
end repeat
set the forecolor of sprite 2 to 250
end
说明:
在循环语句中设置了精灵2的旋转,其后设置了精灵2的颜色。

图7-30 第2帧位置的Lingo脚本
(7) 在Score窗口的Script通道中双击第4帧,在弹出的Script窗口中,输入以下Lingo控制语句,如图7-31所示。
on exitFrame me
go to the frame
end
说明:
当播放到该帧时,将停留在该帧上。

图7-31 第4帧位置的Lingo脚本
(8) 保存电影文件,执行Window→Inspectors→Property命令,在控制面板中播放电影。效果如图7-32所示。

图7-32 碰撞的动画效果 |