FORUMS: list search recent posts

Increase number/content of text when passing layer marker?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Lennert Schrader
Increase number/content of text when passing layer marker?
on Dec 8, 2011 at 5:56:55 pm

Hi,

I need a textlayer to increase its content by 1 on each layer marker.

Example:
Lets say my textlayer says "0".
After my time passed a layer marker, my text should now say "1".
And after passing another layer marker it should say "2".
And so on.

I am not so familiar with expressions, so I don't know what I need to write and that's why I am asking here.
But I guess it would look something like this (roughly):

myText = 0;
text.sourceText = myText;
onLayerMarker: myText++

Does anyone know how to do this correctly?

Any help would be really appreciated! =)

Thanks,
Lennert


Return to posts index

Lennert Schrader
Re: Increase number/content of text when passing layer marker?
on Dec 8, 2011 at 6:15:57 pm

I found the solution!!!
I found it in this forum - sorry for not looking well enough before!

If anyone comes by, below is the expression I ended up using.

I added the last line of code, to change the initial starting number of my text layer (2853).
The number will begin to change from the second layer marker on.

Thanks to Walter Soyka - I used his expression from here:
http://forums.creativecow.net/thread/2/989308

m = thisLayer.marker;
i = m.nearestKey(time).index;

if (m.nearestKey(time).time > time){ i--;}
if (i &lt; 1) { i = 1};
i--;

text.sourceText = i+2853


Return to posts index

Kevin Camp
Re: Increase number/content of text when passing layer marker?
on Dec 8, 2011 at 6:26:19 pm

glad you found a solution... and as with most things in ae, there are many ways to do the same thing... another method would be to use the marker's index value to increase the values:

n = marker.nearestKey(time).index;
if (marker.key(n).time >= time) n-1 else n;


Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index


David Cabestany
Re: Increase number/content of text when passing layer marker?
on Sep 16, 2016 at 8:51:10 pm

Hey Kevin, this expression does exactly what I need, except that it jumps in whole increments, i.e. goes straight from 2 to 3 and I need it to go 2, 2.01, 2.02, etc all the way to 3 and so on. Basically add a linear expression into yours; but I'm not very clear on where to integrate the missing code, do you mind helping with that?

Thanks in advance.
D.


Return to posts index

David Cabestany
Re: Increase number/content of text when passing layer marker?
on Sep 16, 2016 at 8:55:37 pm

By the way, I'm not using it to drive text but increasing the value of a parameter at irregular intervals. I started using loopOut ("offset") but I need the time in between to be different each time.


Return to posts index

David Cabestany
Re: Increase number/content of text when passing layer marker?
on Sep 17, 2016 at 12:03:41 am

I tried something like this, but it's not working. Anyone?

n = marker.nearestKey(time).index;
if (marker.key(n).time >= time)
n-1
else
linear(time,0,1,n-1,n);


Return to posts index

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