Skip to main content
Known Participant
Jul 4, 2024 10:35 AM UTC
Question

Expressions for animating text without keyframing (inPoint endPoint?)

Hi all

 

BIt of a novice on expressions

I have a lot of text I need to animate, what i'd like is an expression which uses the inPoint and endPoint of the layer to play the text Animator and animate the words in and out.

 

Mainly so that I dont have to adjust the distance between keyframes depending how many words are in that text layer, meaning the speed of the animations are consistent/standardised.

 

e.g A text layer with 1 word will take 0.1 seconds to transition, 5 words will take 0.5 seconds, and a layer with 10 words take 1 second.

I'm currently using this bounce expression on an Expression Selector in the Animator-

delay = .00;
 myDelay = delay*textIndex;
 t = (time - inPoint) - myDelay;
 if (t >= 0)
	{ 
	freq =0.0;
	 amplitude = 250;
	 decay = 10;
	 s = amplitude*Math.cos(freq*t*2*Math.PI)/Math.exp(decay*t);
	 [s,s]
	 }
	else
	{
	 value
	 }

this basically does what I'm after (though has unnecessary bounce code in there as dont know how to remove), but I'm struggling to work out how to do this for the transition out.

 

Thanks for any help!

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Dan Ebberts
Community Expert
Community Expert
Jul 4, 2024 7:41 PM UTC

I think if you make sure you delete the Range Selector and set the Scale Animator value to 0, then you should be able to use an Amount expression like this for the Expression Selector:

fadeDur = .7;
fadeIn = linear(time,inPoint,inPoint+fadeDur,100,0);
fadeOut = linear(time,outPoint-fadeDur,outPoint,0,100);
Math.max(fadeIn,fadeOut)

 

Translate
shmithsAuthor
Known Participant
Jul 4, 2024 9:09 PM UTC

Thanks, It's position/opacity i'm trying to animate (so the words move down and fade)
On position, it almost does the job but it moves the entire line (the animator is set to wrods) and doesnt stagger them.
On scale, it scales the individual word but also with no stagger/delay.

Appreciate the help!

Translate
Dan Ebberts
Community Expert
Community Expert
Jul 4, 2024 9:20 PM UTC

Ah, OK. I saw you had the delay set to .00 so I figured you weren't using it. Try it this way:

fadeDur = .7;
delay = .1;
t = time - (textIndex-1)*delay
fadeIn = linear(t,inPoint,inPoint+fadeDur,100,0);
fadeOut = linear(t,outPoint-fadeDur-textTotal*delay,outPoint-fadeDur,0,100);
Math.max(fadeIn,fadeOut)
Translate
Mylenium
Legend
Jul 4, 2024 3:12 PM UTC

My brain is a bit fried at the moment, but something liek this should work (untested):

mSpeed=0.1;
mDur=mSpeed*textTotal;
mStart=time-inPoint;
mEnd=outPoint-time;

if (time => inPoint && time <= inPoint+mDur)
{mStart*mSpeed*textIndex};
else if (time <= outPoint && time >= outPoint-mDur)
{mEnd*mSpeed*(textTotal-textIndex)};
else
{value};

Mylenium

Translate
shmithsAuthor
Known Participant
Jul 4, 2024 9:05 PM UTC

Thanks, this gives me an error-

Translate