// Last edited on DATE TIME by USER
// Processed by remove-cam-lights

background{ color rgb < 0.75, 0.80, 0.85 > }

#declare raio = 2.000;

#declare tinta_A =
  texture {
    pigment { color rgb < 0.10, 0.80, 1.00 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare tinta_B =
  texture {
    pigment { color rgb < 1.00, 0.80, 0.5 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare tempo = clock;

#declare h = 0.2;

#declare cir = 360;

#declare acel = cir/(2*h*(1-h));

#declare vel = 2*acel*h;

#declare pos2 = -acel*h*h;

#declare vagao =
  box {
    < -0.1, -0.2, 0 >,
    < 0.1, 0.2, 0.4 >
    texture { tinta_A }
  }

#declare trilho1 =
  cylinder {
    <0,0,-0.1>,
    <0,0,0>,
    2
    open
    texture {tinta_B}
  }

#declare trilho2 =
  cylinder {
    <0,0,-0.1>,
    <0,0,0>,
    2.2
    open
    texture {tinta_B}
  }

#declare r1 =
  cylinder {
    <-0.1,-0.2,0>,
    <-0.12,-0.2,0>,
    0.06
  }

#declare r2 =
  box {
    <-0.12,-0.21,-0.05>,
    <-0.13,-0.19,0.05>
    texture {tinta_B}
  }

#declare roda =
  union {
  object {r1}
  object {r2}
 }

#declare trilho =
  union {
   object {trilho1}
   object {trilho2}
  }

#declare trem =
 union {
   object {vagao}
   object {roda}
   object {roda translate <0,0.4,0>}
   object {roda translate <0.2,0.4,0>}
   object {roda translate <0.2,0,0>}
   translate <2.1,0,0>
 }

 #if (tempo < 0.20)
   object {trem rotate (acel*(tempo*tempo))*z}
 #else
   #if (tempo < 0.80)
     object {trem rotate (pos2+vel*(tempo))*z}
   #else
     object {trem rotate (cir-acel*(1-tempo)*(1-tempo))*z}
   #end
 #end
 object {trilho}

#include "camlight.inc"
camlight(<0,0,0>,<-3.500,-3.500,1.500>,1.00,z,1.0)