Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can't find the words to Express myself, Nestled parenthesis?

Explorer ,
Sep 06, 2010 Sep 06, 2010

Hi,

I have a project I am supposed to turn over to other people so they can "easily edit" and produce the same thing over and over. that would be too simple, so I decided to put as much of the stuff they would need to adjust into a comp "configuration"

this is the expression I used to change the text at any given time. I like this expression because it's easier to work with than source and lets you move markers over lots of layers without having to twirl down each layer to read or move keyframes:

comp("configuration").layer("EDIT-TOP-TEXT-PANEL1").marker.nearestKey(time).comment;

the problem I am having is that it chooses the nearest marker, so you have to guess/tweak till you find the middle. Instead I want to use the last marker until I reach the next

thisLayer.marker.key(thisLayer.marker.numKeys).time

when I try

comp("configuration").layer("EDIT-TOP-TEXT-PANEL1").marker.key(comp("configuration").layer("EDIT-TOP-TEXT-PANEL1").(numKeys).time.comment)

I've broken the expression, I've actually tried to reference the external layer a few ways but seem to break everything when I leave tried and true.

(thanks Mylennium for the pointer to the expression)

BTW, those learning expressions, should check out this page, it's got some nice reference and examples.

http://www.jjgifford.com/expressions/basics/index.html

TOPICS
Expressions
883
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 06, 2010 Sep 06, 2010

You need to find the middle yourself by dividing the time span between the keys and then use if()else() to determine the preceding and successive key. The timespan itself can be determined by comparing the marker/ key times with the current time nad compansating for the flip-flopping, i.e. at one point the current key is the nearest key index and when it passes beyond the half it is nearest key index -1 or +1, depending on the situation. A bit of overhead, but manageable.

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2010 Sep 06, 2010
LATEST

This might be what you're looking for:

L = comp("configuration").layer("EDIT-TOP-TEXT-PANEL1");
n = 0;
if (L.marker.numKeys > 0){
  n = L.marker.nearestKey(time).index;
  if (L.marker.key(n).time > time) n--
}
(n > 0) ? L.marker.key(n).comment : ""

It should display the comment of the most-recent previous marker (or nothing, if there isn't one)

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines