一、复制:
mybox=box()
showsource for i=1 to 5 do
(
box_copy=copy mybox
box_copy.pos=[i*50,0, 0]
)
二、糖葫芦
for i in 1 to 10 do
sphere radius:(i*10)position:[0,(10*(1.0*i)^2)-10,0]
三、垫子
hide geometry
--清除场景
spheres=for i in 1 to 10 collect
sphere radius:(i*10) position:[(10*(1.0*i)^2)-10,0,0]
--这个例子将创建的球体对象收集袄数组中
spheres[3]
--利用索引访问数组中元素
for i in spheres do print i.radius
--打印数组中所有对象的半径属性
inc=10
--定义了一个局部变量做增量
for angle in 0 to 360 by 30 do
(
instance spheres rotation:(Quat angle z_axis)
)
四、随机颜色
mapped function rand_color x=
x.wirecolor=random(color 0 0 0) (color 255 255 255)
for i in 1 to 30 do box pos:[i*50,0 ,0]
a=for obj in $box*
where obj.height >5 collect obj
rand_color a
五、动画1
mybox=box()
animate on
(
at time 0(mybox.pos=[-100,0,0];mybox.scale=[1,1,1])
at time 100 (mybox.pos=[100,0,0];mybox.scale=[1,1,3])
)
六、动画2 mesh动画
kos=sphere radius:100
converttoMesh kos
animatevertex kos #all
animate on
(
for v=1 to kos.numverts do
(
v_pos_track="$"+kos.name+".vertex_"+(v as string)+".controller"
v_pos=execute(v_pos_track)
at time 0 v_pos_last=v_pos.value
for t=1f to 100f do
(
at time t
(
v_pos.value=v_pos_last+(random[-15,-15,-15][15,15,15])
v_pos_last=v_pos.value
)
)
)
七、动画3旋转
theTeapot=teapot()
animate on at time 10 rotate theTeapot 180 z_axis
八、浮动面板
rollout test9 "阵形集锦(LILIANFU制作)" width:162 height:54
(
button btn11 "糖葫芦" pos:[15,10] width:80 height:35 toolTip:"10个葫芦"
on btn11 pressed do
(
spheres=for i in 1 to 8 collect
sphere radius:(i*8) position:[(8*(1.0*i)^2)-8,0,0]
)
button btn13 "垫子" pos:[105,10] width:80 height:35 toolTip:"10*50"
on btn13 pressed do
(
spheres=for i in 1 to 6 collect
sphere radius:(i*8) position:[(8*(1.0*i)^2)-8,0,0]
--这个例子将创建的球体对象收集袄数组中
spheres[3]
--利用索引访问数组中元素
for i in spheres do print i.radius
--打印数组中所有对象的半径属性
inc=10
--定义了一个局部变量做增量
for angle in 0 to 360 by 20 do
(
instance spheres rotation:(Quat angle z_axis)
)
)
button btn12 "曲 线" pos:[15,50] width:80 height:35 toolTip:"r=10"
on btn12 pressed do
(
for i=1 to 60 do
(
sphere pos:[15*i,80*sin(i*8),-80*cos(i*8)] radius:15
sphere pos:[15*i,-80*sin(i*8),80*cos(i*8)] radius:15
)
)
button btn14 "盒子阵" pos:[105,50] width:80 height:35 toolTip:"r=10"
on btn14 pressed do
(
d=box()
for i=1 to 20 do
for j=1 to 20 do
in d
copy d pos:[i*20,j*20,30*cos(j*20)+20*sin(i*20)]
)
)
createdialog test9 200 300
九、修改器
my=box length:20 width: 10 height:20
my.name="redbox"
my.pos=[0, 100 ,0]
my.scale=[2,3, 2]
move my[20, -100,0]
rot_box=eulerangles 30 60 60
(eulerAngles 30 60 60)
rotate my rot_box
showclass "*:mod*"
addModifier my(twist angle:30)
10.
--对场景中所有的球体设置段数为8
s=$sphere**
for s1 in s do
s1.segs=8
--脚本跟踪器(Open Listener)
--1.快捷键F11
--2、宏记录MacroRecorder/Enable
--MaxScript是它内部语言,其插件只能
--在内部运行。Ctrl+E执行程序