// Exercicio 6
// RA 7849
// Last edited on 2001-07-30 10:42:05 by stolfi

#include "colors.inc"

background{ color rgb < 0.75, 0.53, 0.00 > }

light_source {
  < 4.00, 10.00, 50.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 

camera {
  location  <  8.00, 4.00, 2.00 >
  right     < -1.20, 0.00, 0.00 >
  up        <  0.00, 0.00, 0.90 >
  sky       <  0.00, 0.00, 1.00 >
  look_at   <  0.00, 0.00, 0.00 >
} 

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

#declare cor_cristal = <0.40,0.80,1.00>;
#declare tx_cristal =
texture{
  finish {
     ambient 0.1 diffuse 0.1
     reflection 0.25
     specular 1 roughness 0.001
}
pigment {color cor_cristal filter 1 }
}

#declare copo =
cylinder {
    <0, 0, 0>,     // Center of one end
    <0, 0, 2>,     // Center of other end
    0.5            // Radius
    open           // Remove end caps
    texture { tinta_B }
}

#declare rotulo =
 text{
    ttf "arial.ttf"
    "POVVY"
    0.10,0
}

#declare rotulo2 =
 text{
    ttf "arial.ttf"
    "Agora em nova embalagem"
    0.10,0
}

#declare pingo =
  sphere {
    < 0.00, 0.00, 0.00 >, 0.20 
    texture { tx_cristal } hollow interior {ior 1.5}
  }

#if (( clock > 0.0 ) & ( clock < 0.4 ))
    object {copo rotate 30*y translate <0,-4,2> }
#end

#if (( clock > 0.0 ) & ( clock < 0.4 ))
     #declare var = ( 1 - clock ) * <0,-3.5,1.5> + clock * <0,-1,-3>;
     object {pingo translate var}
#end

#if ( clock < 0.4 )
    object {rotulo rotate 90*x rotate 120*z translate <0,-2,-3>}
#else
    #declare var1 = ( 1 - clock ) * <0,-2,-3> + clock * <0,-2,-1>;
    #declare var2 = 2 + clock;
    object {rotulo rotate 90*x rotate 120*z translate var1 scale var2} 
#end

#if ( clock = 1.0 )
    object {rotulo2 rotate 90*x rotate 120*z translate <0,-7,-6>}
#end 

//object {copo rotate 30*y translate <0,-4,2> }
//object {pingo translate <0,-3.5,1.5>}
//object {pingo translate <0,-1,-2>}
//object {rotulo rotate 90*x rotate 120*z translate <0,-2,-3>}


//fim