ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to link scrolling numbers to another layer's scale

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Willie FrazierExpression to link scrolling numbers to another layer's scale
by on Apr 6, 2012 at 4:06:54 pm

Hello all,

So, I am fairly new to expressions, and was just given a task for which I am going to need one. I am to take a picture and scale it down, and under the picture there should be resolution sizes, like 1920x1280. As the image scales down the numbers should dynamically change down until to new resolution is hit. There will be at least 2 such hits, possible more.

Thanks in advance for any help,

-Will


Return to posts index

Walter SoykaRe: Expression to link scrolling numbers to another layer's scale
by on Apr 6, 2012 at 4:22:00 pm

There's a dedicated After Effects expressions forum [link], but I'll give it a go here.

Create a new text layer, through in some dummy text, and position and format it as you like. Click the disclosure triangle next to the text layer in the timeline panel, then alt-click the Source Text stopwatch. Enter the following:

i = thisComp.layer("image.jpg");
w = Math.floor(i.width*i.transform.scale[0]/100);
h = Math.floor(i.height*i.transform.scale[1]/100);
w + "x" + h



Of course, change "image.jpg" to match the name of your image layer.

Translated to English:
  • Consider "i" shorthand for the image.jpg layer
  • Let "w" equal the width of the image.jpg layer, times its scale, divided by 100. Lob off anything after the decimal point so I get a whole number of pixels.
  • Likewise for "h" and height.
  • Return a text string of the width, the letter x, then the height.


Please note that this will break if you use parenting to affect the scale.

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

Dave LaRondeRe: Expression to link scrolling numbers to another layer's scale
by on Apr 6, 2012 at 4:25:45 pm

I don't think this absolutely, positively calls for the use of expressions. You could use the numbers effect, animating the change along with the scale. I doubt anyone would know the difference.

Unless, of course, someone's going to scrutinize this frame-by-frame, point out that the ratios between the two numbers aren't always precise, and give you a failing grade because of it. Then you might need expressions.

Dave LaRonde
Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA


Return to posts index

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