FORUMS: list search recent posts

Like the iphone Animation: Leading and Kerning with Scripts

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>

David Escurriola
Like the iphone Animation: Leading and Kerning with Scripts
on Jul 1, 2011 at 4:31:38 pm

Hallo everybody

I'm doing an animation where a finger should scroll through the numbers like it works on the iphone.
This Numbers will should at -50'000 and end up at 2011. I've been using some scripts posted in Creativecow and other webages but I will like to be able to change the leading (distance between lines) and the kerning (distance between every single character). I've been fighting with this settings for a very long time. Do you know how to add those slider controllers? is added aswell two pictures who shows the final comp. My second problem is how the animate the values with thousand apostroph inbetween (like 50'000 or 4'000).

Thank you very much for your help

Greetz from Zurich

David

Link to the AFX CS5 File: 2497_numbersexpression.aep.zip


Return to posts index

Dan Ebberts
Re: Like the iphone Animation: Leading and Kerning with Scripts
on Jul 1, 2011 at 5:47:00 pm

This should give you the apostrophes (assuming n is an integer):


n = Math.round(effect("Slider Control")("Slider"));
pre = n < 0 ? "-" : "";
s = ""+ Math.abs(n);
str = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--){
str += "'" + s.substr(-i*3,3);
}
pre + str



As far a leading and kerning, expressions have no access to those (scripting either, for that matter). The closest you could come would be to add Line Spacing and Tracking animators.

Dan



Return to posts index

David Escurriola
Re: Like the iphone Animation: Leading and Kerning with Scripts
on Jul 1, 2011 at 7:39:13 pm

Hi Dan. Thanks for your soon replay. I tried your expression placing it at the Text Source and tested on several ways like replacing all the "n" through 1000 (with and without apostrophe) but It's not working. "Unterminated string constant Expression disabled" is what After Effects tells me. Can you please explain me, where did I go wrong?

It's quite weak I can not set the kerning with different values, since the apostroph need less space than a zero. But ok, I guess I can live with it.

Now regarding of Spacing. I don't use spacing as such, since every line is on a different layer. Look at he script underneath: i've been editing the value of "2500" by hand, so that the layer underneath has a value of 2700, 2900 and so on. But the script "thisComp.layer(index - 1)" doesn't work

Did you opened the sequence I sent? I guess you will see quite fast what I mean.
Thanks very much
David

x=comp("MasterController").layer("Null 1").effect("Slider Control")("Slider") + 2500;
range=300; //range when Z begins
center=thisComp.width*0.5; //center of comp on X axis
distance=x-center;
Zdist=400;

if (x &lt;= center ){
Zpos=ease(center+distance,center-range,center,value[2],value[2]-Zdist);
}else{
Zpos=ease(center+distance,center,center+range,value[2]-Zdist,value[2]);
}

[x,value[1],Zpos]


Return to posts index


Dan Ebberts
Re: Like the iphone Animation: Leading and Kerning with Scripts
on Jul 1, 2011 at 8:15:37 pm

This doesn't work?


n = 1000;
pre = n < 0 ? "-" : "";
s = ""+ Math.abs(n);
str = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--){
str += "'" + s.substr(-i*3,3);
}
pre + str


Dan



Return to posts index

David Escurriola
Re: Like the iphone Animation: Leading and Kerning with Scripts
on Jul 1, 2011 at 8:33:38 pm

Dear Dan

I have to confess, that my expressions skills are to limited to implement your expression in the right place.
This was the reason, I asked you if you had a look into the afx file i sent to you.
thank you veeeery much for your help
david


Return to posts index

David Escurriola
Re: Like the iphone Animation: Leading and Kerning with Scripts
on Jul 7, 2011 at 6:54:10 am

Dear Dan

Yes, it is working. Thanks very much for your support. But the result was due of the impossiblity of edit the kerning at the apostroph not usable. So I had to do it manually.

Best wishes

David


Return to posts index

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