POV-Ray : Newsgroups : povray.windows : Clock Animation Server Time
28 Jul 2024 16:29:10 EDT (-0400)
  Clock Animation (Message 1 to 1 of 1)  
From: David Young
Subject: Clock Animation
Date: 31 Aug 1998 20:32:10
Message: <35EB323A.55719381@cln.etc.bc.ca>
Under the Insert menu, in the Animation
Popup menu there is a "clock".  When I inserted
it, all I got was a // FIX-ME message.  So that
gave me an idea, I began work on a clock animation
(acually a clock).  The hour hand moves from 4 to
5 and the minute hand moves all around.  Here is
the code (it will probably need some fixing before
you - if you - use it in POV-Ray):

// Clock Animation for POV-Ray
//    David Young

background { < 0, 0, 0> }
camera {
  location  <-5, -8, 7>
  angle 68
  sky       <0, 0, 1>
  look_at   <0.5, 2, 4>
}
light_source { <15, -15, 15> <1, 1, 1> }

union { //           Min Hand
  box {
    <-1, -1, -1>, <1, 1, 1>
    scale <0.3, 0.125, 1.0>
    translate  <0.0, 0.6, 5.5>
  }
  prism {
   linear_sweep
   linear_spline
   -1.0,0.0
   4
   <-1.0, -1.0>,
   <1.0, -1.0>,
   <0.008493, -0.008493>,
   <-1.0, -1.0>
   rotate -x*90
  texture {
   pigment {
    rgb <0.2, 0.2, 0.2>
   }
  }
   scale <0.5, 1.0, 0.25>
   rotate 90.0*x
   translate  <0.0, 0.75, 7.25>
 }
 texture {
  pigment {
   rgb <0.2, 0.2, 0.2>
  }
 }
 translate -4.5*z
 rotate clock*360*y
 translate 4.5*z
}
union { //           Hour_Hand
  box {
    <-1, -1, -1>, <1, 1, 1>
    scale <0.3, 0.125, 0.6>
    translate  <0.0, 0.625, 5.1>
  }
 prism {
   linear_sweep
   linear_spline
   -1.0,0.0
   4
   <-1.0, -1.0>,
   <1.0, -1.0>,
   <0.008493, -0.008493>,
   <-1.0, -1.0>
   rotate -x*90
   scale <0.7, 1.0, 0.25>
   rotate 90.0*x
   translate  <0.0, 0.75, 6.5>
 }
 texture {
  pigment {
   rgb <0.2, 0.2, 0.2>
  }
 }
  translate  <0, -0.25, -4.5>
  rotate (120+(clock*30))*y
  translate 4.5*z
}
cylinder {
  <0,0,1>, <0,0,0>, 1
 texture {
  pigment {
   rgb <0.2, 0.2, 0.2>
  }
 }
  scale <0.5, 0.5, 0.6>
  rotate -90.0*x
  translate  <0.0, 0.25, 4.5>
}
difference { //         Clock
 union {
   cylinder { // Clock Body
     <0,0,1>, <0,0,0>, 1
     scale 4.0
     rotate -90.0*x
     translate  4.5*z
   }
   superellipsoid { // Clock Base
     <0.4, 0.3>
     scale <4.5, 1.5, 0.5>
     translate  <0.0, 2.1, 0.5>
   }
   torus { // Clock Front
     1.75, 0.25  rotate -x*90
     scale <2.1, 2.1, 2.0>
     rotate -90.0*x
     translate  4.5*z
   }
   torus { // Clock Back
     1.85, 0.15  rotate -x*90
     scale <2.05, 2.05, 2.0>
     rotate -90.0*x
     translate  <0.0, 4.0, 4.5>
   }
 }
  cylinder {
    <0,0,1>, <0,0,0>, 1
    scale <3.15, 3.15, 1.0>
    rotate -90.0*x
    translate  <0.0, -0.25, 4.5>
  }
 texture {
  pigment {
   rgb <0.9, 0.9, 0.2>
  }
  finish {
   ambient 0.2
   diffuse 0.7
   brilliance 4.0
   phong 0.75
   phong_size 80.0
   roughness 0.1
   metallic 1.0
  }
 }
}
union { //           Hour Dots
  cylinder { // Hour Dot1
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <-1.375, 0.625, 6.88157>
  }
  cylinder { // Hour Dot2
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <-2.38157, 0.625, 5.875>
  }
  cylinder { // Hour Dot3
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <-2.75, 0.625, 4.5>
  }
  cylinder { // Hour Dot4
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <-2.38157, 0.625, 3.175>
  }
  cylinder { // Hour Dot5
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <-1.375, 0.625, 2.11843>
  }
  cylinder { // Hour Dot6
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <0.0, 0.625, 1.75>
  }
  cylinder { // Hour Dot7
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <1.375, 0.625, 2.11843>
  }
  cylinder { // Hour Dot8
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <2.38157, 0.625, 3.125>
  }
  cylinder { // Hour Dot9
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <2.75, 0.625, 4.5>
  }
  cylinder { // Hour Dot10
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <2.38157, 0.625, 5.875>
  }
  cylinder { // Hour Dot11
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <1.375, 0.625, 6.88157>
  }
  cylinder { // Hour Dot12
    <0,0,1>, <0,0,0>, 1
    scale <0.25, 0.25, 0.1>
    rotate -90.0*x
    translate  <0.0, 0.625, 7.25>
  }
 texture {
  pigment {
   rgb <0.2, 0.2, 0.2>
  }
 }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.