ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Is it possible (Character to Anchor Point)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott McGee
Is it possible (Character to Anchor Point)
on Sep 22, 2017 at 1:59:43 pm

I've never thought about it....

Is there anyway to reference a character to be able to assign the anchor point to that character.

e.g

Friday 23rd - 19:45

I want it to be central ("-") everytime, but to just centralise it wouldn't work as there is more characters on the left.

My thoughts, is to centralise the anchor point, then in position try and find how many characters there is up to ("-"), and subtract it so it offsets itself left to centralise automatically.


Return to posts index

Dan Ebberts
Re: Is it possible (Character to Anchor Point)
on Sep 22, 2017 at 5:15:35 pm

Interestingly, this kind of works.

Add this expression to your source text:


s = value.split("-");
if (time < 0)
s[0] + "-"
else
value


and this to the anchor point:

r = sourceRectAtTime(-1,false);
x = r.left + r.width;
[x,value[1]]



Dan



Return to posts index

Scott McGee
Re: Is it possible (Character to Anchor Point)
on Sep 26, 2017 at 10:43:14 am

Hey Dan,

If there's a more accurate way brill...If not worked enough for me to fiddle with it.

I want the anchor to sit on "-", as I have a position expression so it sits directly central on another layer...but just altering the anchorpoint by -33, it sits exactly on the line and works brilliantly.

I tried manipulating s[0] + "-" but just couldn't find an easy way other than to -33.

s = value.split("-");
if (time < 0)
s[0] + "-"
else
value


r = sourceRectAtTime(-1,false);
x = r.left + r.width;
y = r.height/2 + r.top;
[x-33,y]


No sweat if not, it works which is the main thing.


Return to posts index

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