Menu

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!

Get the project file through our Gumroad Store. This project file can only be opened in versions of AE that support Master Properties (2018+).

If you'd like to help support Workbench, check out our Patreon page. Thank you for even considering clicking this link to support what we're doing. We appreciate it.