ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expressions in Precomp React to Value of Slider in Main Comp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Isaac Carlson
Expressions in Precomp React to Value of Slider in Main Comp
on Dec 10, 2018 at 6:31:49 pm

I'm hoping to get some help with a project I'm working on. This one is a bit difficult to explain. I have a series of precomps in a master composition. Each precomp has animated text layers. Each text layer is pulling the source text from a .csv file. The cell # (from the csv) that the text is pulled from is determined by a slider control in the main comp. That slider control has an if/else expression that makes the value determined by the inpoints of layers on the main comp.

The idea is basically to "auto-generate" animated titles from a CSV file. The csv file contains the text, which is pulled into the text layers in After Effects, with the title number determined by a control layer with a slider control in the main comp. Since the slider control is determined by in points it automatically determines the title number based on which layer the playhead is over in the main comp.

This has worked great when all the layers are in one comp, but it falls apart when the text files are in the precomps. As best I can diagnose, it seems like this is because the text files are looking at the slider control value based on the position of the precomps own playhead, as opposed to the position of the playhead in the main comp. This means it always reads the slider control value as "0", no matter at what point the playhead is in the main comp.

Is there any crafty way to tell the text layers to determine their value based on the slider control value at the main comp's playhead? Or am I asking too much of the software? Any advice and guidance is hugely appreciated. I am just beginning to muck about with expressions. Thanks!


Return to posts index

Dan Ebberts
Re: Expressions in Precomp React to Value of Slider in Main Comp
on Dec 10, 2018 at 7:29:39 pm

Your expression needs to adjust the time by the amount of the start time of the precomp layer in the main camp. A straightforward case will end up looking something like this:

C = comp("main comp");
ctrl = C.layer("controls").effect("Slider Control")("Slider");
L = C.layer(thisComp.name);
ctrl.valueAtTime(time + L.startTime)

If you have multiple levels of nesting or any time remapping involved, it can get complex.


Dan



Return to posts index

Jonathan Lutjens
Re: Expressions in Precomp React to Value of Slider in Main Comp
on Feb 8, 2019 at 8:00:33 pm

Scouring the webs for expression help and as is so often the case, the solution was posted by Dan. I've benefited from your knowledge and generosity for years. Thank you!


Return to posts index

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