Tutorial 126: Number Crawl

Joe Clay | Jun 1, 2018

This week, we're going to check out an interesting way to make a number crawl using expressions and master properties. I wanted to avoid using time remapping because it can change the speed of our animations. I also wanted our digits to finish animating when our number stops animating. And above all else, I didn't want this expression to be slow so we needed to keep any lookback loops to a minimum.

While this is mostly an academic exploration, in the end we have a flexible but useful number crawl that has almost no limit to how large the number can be while allowing for animation from number to number.

Here's the expression we applied to our Number master property:

num = thisComp.layer("Controller").effect("Number")("Point");
str = '000000000000' + Math.floor(num[0]);
c = str.length-effect("Index")("Slider");
d = parseInt(str.charAt(c));

i = thisComp.layer("Controller").effect("Duration")("Slider");
while(i > 1) {
    j = '000000000000' + Math.floor(num.valueAtTime(time-(i*thisComp.frameDuration))[0]);
    if (d == j.charAt(c)) {
        k = '000000000000' + Math.floor(num.valueAtTime(time-((i+1)*thisComp.frameDuration))[0]);
        if(j.charAt(c) == k.charAt(c)) {
            break;
        }
    }
    i--;
}

d + i/100;

So I hope you guys learned something from this and we'll see you next week!

Grab the Project Files

The best way to get our project files is to become a patron on Patreon. For $5 a month, you get access to all of the tutorial project files we've made available as well as other monthly projects, rigs, R&D, elements, early product previews, and BTS content not available anywhere else! You can also purchase just this project file on our Gumroad Store if you would rather do that.

Get access to all of our project files on Patreon or Get this single project file on Gumroad