Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
logo
    3D Animations with POV-Ray
        Some basics and samples on animations.
Italiano Italiano
Français français
Deutsch Deutsch
Home
- 3D Animations Gallery
- POV-Ray Tutorial

  3D Animation Tutorial
   Index of Content
  0. Basic Knowledge
     1. Basic Sample
     2. From Images to Video
     3. Basic Terms
     4. Animation Commands  
  I. Cyclic Animations
     1. Rotating Objects
     1.2. Planets in Orbit
     2. Rotating Camera
     3. Western Wheel
         Problem
     3.1. Rolling Wheels
     4. Gears
     4.1. Roller Chain
     4.2. Bike Chain
     5. Swinging Pendulum
     5.1. Newton's Cradle
     6. Spiral Pendulum
     7. Connecting Rods
     8. Psychedelic
        + Op-Art
     9. Counters
        + Countdowns
    10. Folding of a Cube
  II. Animation Paths
      with Spline Curves
     1. Spline Curves
     2. Animation Paths
                                           

Counters and Countdowns
Counters with numbers by text objects
and counters with 7 segment display.

           


Countdown
with numbers by text objects:

For this kind of counter we use the frame_number variable to count directly. We can convert the actual frame_number to a string value for the POV-Ray text object by
str( Number ,   //(the float to convert)
           0   ,        //(no padding left),
           0   )     //(no digits after the point))
Because of the different width of numbers in normal truetype fonts we have to split the number into two digits to avoid horizontal jiggle.
//-----------------------------------
#declare Number = 99-frame_number;
// splitting it in two parts:
#declare Number_10 =
         int(Number/10);
#declare Number_1 =
        (Number-Number_10*10 );
//-----------------------------------
#declare Text_10 =
text { ttf "arial.ttf",
     str(Number_10,0,0),0.001,0
     pigment{ color rgb<1,1,1>}
     translate<0,0,-0.001>
   } // end of text object ----------
#declare Text_1 =
text { ttf "arial.ttf",
     str(Number_1,0,0),0.001,0
     pigment{ color rgb<1,1,>}
     translate<0,0,-0.001>
   } // end of text object ----------
//-----------------------------------
union{
 // don't write things like "08" !
 #if(Number>9)// --------------------
 object{ Text_10
         texture{ Number_Texture }
         translate<0.125,0.2,0>
       } // -------------------------
 #end //-----------------------------
 object{ Text_1
         texture{ Number_Texture }
         translate<0.675,0.2,0>
       } // -------------------------
scale <1,0.65,1>
} // end union ----------------------   












xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Running_Counter
Contdown
Scene descriptions for POV-Ray:
"Running_Counter_10.ini" and
"Running_Counter_10.pov"
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Counter with 7 segment display:
Here we can animate an object defined by macro.
You can see here how to build this display:
    7-Segment Display
For sample files on this macro and for download
of the include file "Seven_Segment_LCD.inc" go here:     POV-Ray Objects - Electronics

Here how to animate this object:
The numbers for both digits were calculated
from the frame_number as follows:
#declare Number = frame_number*3; //0~99

#declare Num_10 = int ( Number/10);
#declare Num_1  = int ((Num_10*10)/1);

#if(Num_10=0) #declare Num_10=99; #end

//----------------------------------
#include "Seven_Segment_LCD.inc"
//----------------------------------
union{
 object{ Seven_Segment_LCD(
         Num_10, // 0~9, integer!
         10, // shearing angle
         < 1.75, 10, 1.40>, //
         Active_Texture,
         Inactive_Texture,
         Background_Texture,
         1, // SS_Point_On,
         0, // SS_Point_Active,
         ) //-----------------------
         scale 0.09
         translate> 0.51,0.05,0>
       } // ------------------------
 object{ Seven_Segment_LCD(
         Num_1,// 0~9, integer!
         10, // shearing angle
         > 1.75, 10, 1.40>, //
         Active_Texture,
         Inactive_Texture,
         Background_Texture,
         1, // SS_Point_On,
         0, // SS_Point_Active,
         ) //------------------------
         scale 0.09
         translate> 3*0.51,0.05,0>
       } // -------------------------
 scale 0.5
 rotate>-90,0,0>
 translate< 0, 0.4, 0>
} // end union ----------------------


Seven_Segment_LCD
2 Digits 7-Segment Display
Scene descriptions for POV-Ray:
"Seven_Segment_LCD_run02.ini", "Seven_Segment_LCD_run02.pov"
and "Seven_Segment_LCD.inc"













Seven_Segment_LCD_Display
A "Seven_Segment_LCD_Display"
more advanced
you can find at the page
Seven_Segment_LCD_Display
top

© Friedrich A. Lohmüller, 2009
email email: Friedrich.Lohmueller_at_t-online.de
homepage:http://www.f-lohmueller.de