Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Dynamic Flip-clock style number flipper in After Effects

  • Dynamic Flip-clock style number flipper in After Effects

    Posted by Dan Schreiner on January 8, 2013 at 11:08 pm

    Hey Guys,

    I’m trying to create a flip style counter similar to an embedded one I found on a website. I’ve created the flipper and pre-composed it and have it set to loop but I’d like to set it so that I can control it with an expression slider.

    I’ve read through previous posts and seen people just do time re/mapping and dividing by 10, or 100 or whatever but this causes the problem of the flipper moving slow when it finally changes over. Any thoughts or suggestions on how to hook everything up to one slider for easy control.

    Thanks.
    Dan

    Simon Brown replied 5 years, 4 months ago 5 Members · 8 Replies
  • 8 Replies
  • Vishesh Arora

    January 9, 2013 at 9:50 am

    Dan

    Dynamic Bar Graphs

    In this tutorial, Andrew Kramer links the Time-Remap to a slider to control it. It may help.

    Vishesh Arora
    3D and Motion Graphics Artist
    Films Rajendra

    Blog:
    https://digieffects.wordpress.com

    Demo Reel(3D):
    https://www.youtube.com/watch?v=lHPgIJU_BR8

  • Walter Soyka

    January 9, 2013 at 7:48 pm

    [Dan Schreiner] “I’ve read through previous posts and seen people just do time re/mapping and dividing by 10, or 100 or whatever but this causes the problem of the flipper moving slow when it finally changes over. Any thoughts or suggestions on how to hook everything up to one slider for easy control. “

    I’ve seen this question come up a couple times here, so I had a quick go at it with some downtime in a waiting room. This might still be a bit rough around the edges, but it should give you or anyone else looking for an odometer-style animation where all the numbers flip together a good start.

    The attached demo movie and sample project use an expression which controls the time-remapping on multiple different layers of the same loopable, 10 second, single-digit counter. The expression lets the ones digit go freely according to the controller slide, but holds all other digits on their value until it is time to transition with the ones digit.

    Here’s the file:
    5194_advancedodometer.aep.zip

    Here’s the demo movie:

    Advanced Odometer Demo

    And finally, here’s the time-remapping expression:
    // Figure out what digit this layer should show -- 1 for ones, 2 for tens, 3 for hundreds, etc.
    myPlace = index - thisComp.layer("Counter Controller").index;

    // Get the source number from the controller layer
    myNumber = thisComp.layer("Counter Controller").effect("Number")("Slider").value;

    // then convert it to a string (with no decimal places) for easier manipulation
    numberAsString = Math.floor(myNumber).toString();

    // if we're the ones digit, we can just return the number modulo 10
    if (myPlace == 1) myNumber % 10

    // but if we're any other digit, we have to hold our digit until we reach the next transition number
    else {
    // do some string manipulations to strip off all the digits above the one we're on (for the hundreds digit, strip thousands and above off)
    strippedNumber = numberAsString.substring(numberAsString.length-myPlace,numberAsString.length);

    // this layer should show the first digit of our new stripped number
    if ((strippedNumber.length < 2) || (myPlace > strippedNumber.length)) myDigit = 0 else myDigit = strippedNumber.substring(0,1);

    // figure out what the next number we should transition on
    nextTransitionNumber = (parseInt(myDigit) + 1) * Math.pow(10,myPlace-1) - 1;

    // if we're on a transition number, then we can transition; otherwise, we should hold our digit
    if (strippedNumber >= nextTransitionNumber) transitionTimeOffset = myNumber - Math.floor(myNumber)
    else transitionTimeOffset = 0;
    parseInt(myDigit) + transitionTimeOffset;
    }


    I’d be happy to answer questions.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Dan Schreiner

    January 9, 2013 at 9:59 pm

    Damn Walter!

    You’re my hero today. Solid work. I’ll try it myself and repost what I come up with. Thank you so much!

    ~Dan

  • Tom Daigon

    January 10, 2013 at 12:33 am

    Its very cool Walter, but didnt the OP say he wanted a flip style clock?

    I am impressed with your expression, but they dont seem like the same thing. And probably require a different solution to achieve.

    Tom Daigon
    PrP / After Effects Editor
    http://www.hdshotsandcuts.com
    https://www.youtube.com/watch?v=DxPrG3WUyz8
    (Best viewed at 1080P and full screen)
    HP Z820 Dual 2687
    64GB ram
    Dulce DQg2 16TB raid

  • Walter Soyka

    January 10, 2013 at 1:49 am

    [Tom Daigon] “Its very cool Walter, but didnt the OP say he wanted a flip style clock?”

    Well, I didn’t do ALL Dan’s homework for him…

    [Tom Daigon] “I am impressed with your expression, but they dont seem like the same thing. And probably require a different solution to achieve.”

    The expression isn’t actually making the numbers in the digit precomp rotate; I did that myself, by hand, in a 10 second, seamlessly loopable precomp. That precomp is structured such that each digit hits on the second; in other words, time 0.0 shows the digit 0, time 1.0 shows the digit 1, time 2.0 shows the digit 2, etc. The animation is continuous, so 0.5 shows the space halfway between 0 and 1, and 9.5 shows the space halfway between 9 and 0.

    The expression, applied to the precomp in a main comp, drives the time-remapping for multiple instances of that precomp in a main comp. By structuring the precomp as I did above, and using time-remapping, we can easily get any specific digit we want (or any part of the digit transition) from that animation. This way, we can hold the constantly moving animation on a single digit, or we can roll through the transition into the next digit.

    You can make the underlying animation in the digit precomp anything you want. I did an odometer-style animation there since it was a fast, easy way to show the concept, but that could just as easily be anything else. If Dan changes that underlying 10s loop precomp to his single-digit flip-clock animation, this expression — untouched — will drive it, with all digits flipping together when appropriate, from a single control.

    Check out the project, and pop the hood. There are a few cool tricks in this project which can be used in other situations, too.

    I used an angle control in one of the comps, because angle controls can be used to pass vastly larger numbers than slider controls (which are needlessly limited to 1 million.) I used the modulo operator (“clock arithmetic”) to drive the looping digits. I converted numbers to strings to use string manipulation techniques on them before converting them back to numbers. I used layer indices (relative to the controller) to drive each digit counter (so it knows which digit in the number it should represent based on its location in the timeline below the controller layer). Little tricks like these can really simplify some otherwise-arduous animation tasks.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Tom Daigon

    January 10, 2013 at 1:56 am

    Haha. Thats right, he should do a little of the work.

    Sorry I didnt mean to sound like a jerk 😛 I just didnt see what I thought I would and now I know why.

    Tom Daigon
    PrP / After Effects Editor
    http://www.hdshotsandcuts.com
    https://www.youtube.com/watch?v=DxPrG3WUyz8
    (Best viewed at 1080P and full screen)
    HP Z820 Dual 2687
    64GB ram
    Dulce DQg2 16TB raid

  • Walter Soyka

    January 10, 2013 at 2:34 am

    Not at all! The point you raised gave me the chance to describe a bit about how the project actually works. My first post on this was a bit of a hit and run, but hopefully talking a little more about what’s going on in the digit counter precomp and in the expression controlling that in the main comp will help make this easier to learn from.

    It’d probably be clearer if I recorded a proper tutorial on this.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Simon Brown

    January 29, 2021 at 6:28 pm

    Hi Walter, this script sounds exactly what I need for a Covid-19 timer I am building, but I’m really struggling to get it to work, as I’m not sure how its applied in the build. Unfortunately the link to your project looks dead (5194_advancedodometer.aep.zip) so I’m really not sure how to investigate this further. Is there anyway you could re-load a link to your project where you apply this script?

    I’d really appreciate your help!

    Simon

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy