What you'll find here is an overview of how I created my homepage animations. This is Part 1 of a two-part series. In Part 2, I'll talk about how YOUR math was used to create the animations above. Then we'll explore other possibilities for the animations. The math concepts you need are 3D coordinates and trigonometric functions - especially the sine function. If you want to follow along and make your own 3D text, first download POV-Ray and set it up.

How I did it

1. Create 3D text in POV-Ray
2. Set up POV-Ray animation rules
3. Export files to a gif animator

## Creating 3D Text in POV-Ray

A POV-Ray scene is a description of a 3D world using English and math definitions. First you need to define a camera to view the scene through. My camera definition looks like this.
    camera {
location  <0, -5, -20>    // Camera is located at x=0 y=-3 z=-8.5
direction 4.5*z           // Focal length makes the lens zoom or wide angle
right     640/480*x       // Aspect ratio stretches or squishes the scene
look_at   <0,-0.25,0>     // Camera points at this
}

Next you need a light source. I have 3 in my scene.
    light_source { < 0, -5,   0> color White }
light_source { <-1, 15, -15> color White }
light_source { <-1,  5, -12> color White }

    text {
ttf "timrom.ttf" "Mr. Ferrante's Homepage" 1, 0  // depth=1, spacing=0
translate <-5.4, -0.5, -0.5>                     // center it
scale <0.5, 0.5, 0.5>                            // shrink it
pigment { Gold }                                 // assign color gold
finish { phong 0.9 }                             // make it shiny
}

Here's the output
and the complete pov file. Load it in POV-Ray and render it. You can change the text to anything you want, but you'll have to re-center it by modifying the x-coordinate of the translate statement and stretch or shrink it by modifying the scale statement.

Why go though all that work, you ask, when there are programs like Xara3D and on-line 3D text generators such as iqAuto? Because POV-Ray is MUCH more powerful! If you want cheap-n-easy, go for the other stuff, but they won't give you my homepage animation or these killer scenes: 1 2 3 4

## Now let's work on a button and animate it.

If you're following along with POV-Ray, you'll need to learn a few new features. Click here to read the file we'll be using.
Let's change the text to "My Button!" and put a squished sphere behind the text as a button. We have
    text {
#declare MyText = "My Button!"                  // You can declare variables
#declare MyFont = "c:\windows\fonts\times.ttf"  // like these.
ttf MyFont, MyText, THICKNESS, 0                // Draws the text
...

and the sphere
    object {
sphere { <0,0,0>, 0.25 }          // center at (0,0,0); Radius 0.25 units
scale <17, 3, 1>                  // stretch it
translate <0, -0.25, 0.2>         // slide it so it doesn't cover the text
pigment { Red }                   // assign red color
finish { phong 0.8 ambient 1 }    // makes it shiny and bright
}

Here's the output and the complete file. Load it in POV-Ray and render it.

## Animate the button!

To make an animation in POV-Ray, you need 2 files.

1. Your regular .pov scene file
2. An animation .ini file

Here's my .ini file for the button.
    Input_File_Name=MyButton.POV

Initial_Frame=1         // 20 frames
Final_Frame=20
Initial_Clock=0
Final_Clock=6.28318     // 2*Pi

Cyclic_Animation=on
Pause_when_Done=off

Now we go back to the .pov file and use the 'clock' variable to make the animation. Here's the output and the complete file. Load it in POV-Ray and render it.

## How the clock variable works

POV-Ray animation is based on a variable that simulates time. This variable's name is clock and whenever POV-Ray sees this word in your scene, it replaces clock with its current value. The idea is to run the clock variable from, say 0 to 20 and then associate that with some kind of movement. For example, if our clock did run from 0 to 20, then this code would translate a sphere 20 units along the z-axis.
    object {
sphere { <0,0,0>, 0.25 }      // center at (0,0,0); radius 0.25 units
translate <0, 0, clock>       // slide it along the z-axis
pigment { Red }               // assign red color
}


Next Up: Part 2 - Using trigonometry to make animations

Homepage