#version 3.0 global_settings { assumed_gamma 1.0 } camera { location < 0, 0, -30> direction 1*z look_at < 0, 0, 0> } background { color rgb <0.0, 0.0, 0.0> } light_source { <50, 20, -50> color rgb 1 } light_source { <0, 0, -40> color rgb <1,0.7,0.4> } #declare BasicShape = // create a crescent shape difference{ sphere { 0,0.5 scale < 1,1,0.25> } sphere { 0.25,0.5 } } // ------------------------------------------------------------------ // Set up the loop variables: // the Counter variable will go from 0.0 to 1.0 // in NumIterations loops. #declare NumIterations = 108 #declare Counter = 0.0 #declare Increment = 1.0/NumIterations #declare Arm = 1 #declare armangle = 0.0 #declare NumTwists = 360*4 union{ #declare Flipper = 1 // Flipper will switch between 1 and -1 each loop #while (Counter<1.0) object { BasicShape scale 3-sin(Counter*3*pi/2) rotate y*Counter*2 rotate x*(Flipper+clock+Counter)*360 translate x*4 rotate 7*cos((Counter*2-clock)*pi*2)*y rotate 10*cos((Counter*2-clock)*pi*2)*z translate <12*(Counter), 0, 0> rotate armangle*z #declare armangle=armangle+60 texture { pigment { // colors change as we stack them up color rgb <0.5-Counter*Counter*0.5, 0.3+Flipper*sqrt(Counter)*0.3, 0.15-0.15*cos(Counter*1440)> } finish { ambient 0.01 specular 0.5 diffuse 0.5 roughness 0.1 } } } #declare Flipper = - Flipper // flip its value (1->-1 or -1->1) #declare Counter=Counter+Increment #end }