ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Camera movement controlled by length of word

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Jones
Camera movement controlled by length of word
on Apr 24, 2019 at 4:17:19 pm

Hello all,

I'm pretty new to expressions within AE, and I'm attempting to control the movement of the comp camera based on the length of words in a pre-comp.

What I really need is an expression that will play a given number of frames at a layer marker, based on the length of string 1 ("text"), and will then move to the next marker and play a given number of frames based on the length of string 2 ("goes") etc.

I've attempted to use this code...and it almost worked, but also really didn't, and only used one of the layers of text.

Any help would be greatly appreciated.

n = marker.numKeys;
l = comp("Text for layer").layer("text").text.sourceText.length;
if (n > 0){
f = timeToFrames(time/(l*10));
idx = Math.min(f + 1, n);
marker.key(idx).time
}else{
value
}


Return to posts index

Kalleheikki Kannisto
Re: Camera movement controlled by length of word
on Apr 27, 2019 at 10:38:51 am

A whole bunch of questions about your setup:

- Are you applying the expression to time remapping?

- How does the camera know where to go? Do you also have keyframes for camera position?

- What is the purpose of the markers? I don't see what they are needed for, since they're not controlling the timing of the animation. Are they there to show where the keyframes are?

- Are you looking at having easing between the positions?

- Why not move the words rather than the camera?

- Can this not be done as a 2D comp?

- Does the camera need to move closer and further away from the word based on length?

etc. etc.

Perhaps a couple of screenshots showing what you currently have and what you are trying to accomplish...?

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Alex Jones
Re: Camera movement controlled by length of word
on May 3, 2019 at 1:14:28 pm

Hi Kalleheikki,

- I am applying to time remapping

- the camera position is key-framed in the pre-comp

-the only reason I used markers was because of other example expressions I'd seen that I thought might work, but you're right, I have subsequently stopped using them.

- The words can't move, as I'm creating typography that would become pretty complex if I had to move all the text.

- Unfortunately the pre comped typography, has the camera moving through a 3D environment

-The camera doesn't need to move closer and further away dependent upon the length no.

Any help would be fantastic I'm at a bit of a dead end.


Return to posts index


Kalleheikki Kannisto
Re: Camera movement controlled by length of word
on May 3, 2019 at 3:03:42 pm

Hi Alex,

This is a very complicated expression with cumulative loops and multiple if situations. I could figure it out in theory but writing the expression turned out to be too complex for my liking at this time.

I would suggest doing the time remapping manually. If you put the camera position keyframes exactly one second apart, it will be an easy task to do the time remapping as each consecutive word will be at the next second mark.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Alex Jones
Re: Camera movement controlled by length of word
on May 3, 2019 at 3:33:12 pm

I was worried this would be the case. Thanks anyway, I will keyframe as you've said for now.


Return to posts index

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