After Effects - Millions to Thousands
I had to create a presentation earlier this week and needed it to look pretty slick. I put together the presentation in Keynote but it was comprised of a series of videos done with After Effects. One of the things I had to do was animate a bar graph moving down. Pretty simple, but I also needed to show the number decrementing as well. Not too hard, but then I needed to show the number decrease from Millions to Thousands. It couldn't say 1,000,000 it had to say '1m'. Now it's getting fun!! The movie shows what it looked like. Below is how I did it.
Step 1: Create Text Layer.
Step 2: Add a Slider Control. Effect > Expression Control > Slider Control
Step 3: Create a new Expression on the Text Layer's "Source Text" Property.
Step 4: Animate Slider.
Step 5: High Five Somebody.
// Add Slider
mySlider=thisLayer.effect("Slider Control")("Slider");
// Set a number range for Slider (SliderInstance, Start, End, Range1, Range2)
// For Millions > Hundred Thousands keep it in the 100's to thousands
myNumber=linear(mySlider,0,100,1600,850);
// Round the number
num = Math.round(myNumber);
// Set the default type to 'k'
type = "k"
// Check to see if it's above 999 and make it equal millions
if(num > 999)
{
type = "m"; // denote as millions
num = num/1000; // divide by 1000 to get a number like 1.5484372384
}
str = "" + num ; // put the number into a string
// the magic - set the text value to equal "$1.53m" or "884k"
// str.slice(0,4) returns the part of str between the first index (first character)
// and the fourth index (fourth charcter) - so for a number like 1.54854234 it'll return
// 1.54 cause it counts the decimal! for a number like 984 it'll just return 984.
["$" + str.slice(0,4)+ type]
// End Expression
-
stephanlen...
17 months ago
Very neat graphic! And gotta luv AE =)
-
SNDKno
16 months ago
AE expressions is just awsome and it looks like Adobe is now even focusing more on it.
To add comments please login OR signup and activate your account by clicking the activation link in the signup confirmation email.



Comments (2)