//Randomly Instance all selected geometry repeatedly //Author: Anand Agarawala global proc RandomInstance(int $times) { string $selected[] = `ls -sl`; string $newinst[]; int $size = `size ($selected)`; float $x, $y, $z, $s; float $distR = 200; // max distance to spread float $distY = 60; for ($a=0;$a<$size;$a++) { string $name = $selected[$a]; // this variable accesses each element of select using $a as an index for($i=0; $i<$times; $i++) { $newinst=`instance $name`; $x = rand(-$distR, $distR); $y = rand(-$distY, $distY); $z = rand(-$distR, $distR); move -r $x $y $z $newinst[0]; } } } // Revision Control System // $Source: /usr/people/hamilton/maya/dev/RCS/stars.mel,v $ // $Revision: 1.2 $ // $Author: hamilton $ // $Date: 1997/09/16 03:18:13 $ /* This script creates spheres in random positions and radii and makes them blink like star */ global proc makeStars(int $max ) { float $distR = 70; // max star distance float $starR = 0.7; // max star radius vector $pos; float $x, $y, $z, $s; string $names[2]; for ( $count = 1; $count < $max; $count++ ) { // get random values for the location anf size $x = rand(-$distR, $distR); $y = rand(-$distR, $distR); $z = rand(-$distR, $distR); $s = rand(0.6+$starR); // create a sphere and get the name for later use $names = `sphere -p $x $y $z -r $s`; // add an expression to the sphere //expression -s "v = blink();" -n v -ae 1 -o $names[0]; } } global proc float blink() { return rand(15); } makeStars(10);