Digital Counter – Expression Tricks Series

Start by editing together a 10 frame clip of the individual numerals 0-9. A separate layer is used for each digit. The more layers the higher the counter can go. We’ve included a pre-made .sgi image sequence in the .tar file which contains the setup.

The first step is to lock the front clip of each layer but still be able to slip them. The expression “-frame + 1” will lock a clip on it’s first frame. This allows you to go to any frame in the back clip without the score changing.

The second step is to isolate the appropriate number (1,10,100,1000) for each digit of the counter and then add that to the slip expression of each layer.

eg. if x is the variable for the counter and we want the counter to read 7658.

 = x - trunc(x /10) * 10
 = 7658 - trunc(765.8) * 10
 = 7658 - 765 * 10
 = 8 which is the value for the first digit
 layer 1 slip: -frame + 1 + trunc(x) - trunc(x /10) * 10

 
expression

= trunc((count.position.x – trunc(count.position.x /100) * 100) / 10)
= trunc((7658 – trunc(76.58) * 100) / 10)
= trunc((7658 – 7600) / 10)
= trunc(5.8)
= 5 which is the value for the second digit

layer 2 slip:

-frame + 1 + trunc((x - trunc(x /100) * 100) / 10)

—————————————————————

For each additional layer add an extra zero to the last three numbers in the expression.

layer 3 slip:

-frame + 1 + trunc((x – trunc(x /1000) * 1000) / 100)

layer 4 slip:

-frame + 1 + trunc((x - trunc(x /10000) * 10000) / 1000)

To change the value of the digits animate the “count” axis X position in the action node. Overall position and scale of the numbers is done with the ax_overall_pos axis. To space out the numbers depending upon the size of the numbers you use, change the x position value for ax_number_pos. The numbers to the left of the digit are linked via expression, making the spacing easy.

Submitter: Alan Fairlie