ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dynamic Flip-clock style number flipper in After Effects

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dan SchreinerDynamic Flip-clock style number flipper in After Effects
by on Jan 8, 2013 at 11:08:50 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



Return to posts index

Vishesh AroraRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 9, 2013 at 9:50:54 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:
http://digieffects.wordpress.com

Demo Reel(3D):







Return to posts index

Walter SoykaRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 9, 2013 at 7:48:44 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


Return to posts index


Dan SchreinerRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 9, 2013 at 9:59:58 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


Return to posts index

Tom DaigonRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 10, 2013 at 12:33:13 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





(Best viewed at 1080P and full screen)
HP Z820 Dual 2687
64GB ram
Dulce DQg2 16TB raid


Return to posts index

Walter SoykaRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 10, 2013 at 1:49:59 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


Return to posts index


Tom DaigonRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 10, 2013 at 1:56:57 am

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

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

Tom Daigon
PrP / After Effects Editor
http://www.hdshotsandcuts.com





(Best viewed at 1080P and full screen)
HP Z820 Dual 2687
64GB ram
Dulce DQg2 16TB raid


Return to posts index

Walter SoykaRe: Dynamic Flip-clock style number flipper in After Effects
by on Jan 10, 2013 at 2:34:20 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]