-- create array of spheres 30 x 20 for x = 1 to 30 do for y = 1 to 20 do sphere pos:[x,y,0] \ name:("dot" + x as string + y as string) \ radius:1 segs:12 -- create material mm = multimaterial numsubs:2 name:"Switch" mm.names = #("on", "off") mm[1].diffuse = mm[1].ambient = white mm[1].selfIllumAmount = 100 mm[2].diffuse = mm[2].ambient = black mm[2].selfIllumAmount = 100 dots = $dot* as array -- make "shortcut" dots.mat = mm -- add the mat as instance -- add uni materialModifier to each "dot" for obj in dots do addModifier obj (materialModifier name:"MatMod") -- create "eye"-helpers eyes = #() eyes[1] = cylinder name:"EyeL" radius:2 height:5 eyes[2] = cylinder name:"EyeR" radius:2 height:5 eyes[1].pos = [4,8,0] eyes[2].pos = [10,8,0] eyes.xray = on eyes.isHidden = on -- animate "eyes" animationRange = interval 0 110 frameRate = 30 set animate on set time 40f eyes.pos.x += 12 eyes.pos.y += 10 set time 68f eyes.pos.y -= 8 set time 110f eyes.pos.x -= 14 eyes.pos.y += 6 set animate off set time off -- animate materialID's with animate on ( for t = 0 to 110 do ( sliderTime = t for obj in dots do if (distance obj.pos eyes[1].pos <= 2) Or \ (distance obj.pos eyes[2].pos <= 2) then obj.modifiers[#MatMod].materialID = 1 else obj.modifiers[#MatMod].materialID = 2 )) playAnimation() --stopAnimation()