4 Replies Latest reply on Nov 2, 2012 6:33 AM by Accumind1

    Text display based on frame number expression help one

    Accumind1

      Hello, I'm hoping there is someone who can assist me with an expression question.

       

      I am trying to find a way to display text based on frame number. Because there will be around 100 description elements, and several may need to display at the same time, I imagine an expression will be the best way to do this.

       

      What I mean is that I will have a list that has the following info: Frame Start Time, Frame End Time, and Description. The text in Description should show from the Frame Start Time until the frame end time. If there is already one Description showing when another Description should start showing, the first one (or ones) should remain and the next one should be added on the next line.

       

      Example:

      Frame Start Time          Frame End Time          Description

      1                                 300                              Text 1

      247                              388                              Text 2

      330                               480                              Text 3

       

      So using the above examples:

       

      Frame 1-247 will display:

      "Text 1"

       

      Frame 248-300 will display:

      "Text 1"

      "Text 2"

       

      Frame 301 - 330 will display:

      "Text 2"

       

      Frame 331 - 388 will display:

      "Text 2"

      "Text 3"

       

      Frame 389 - 480 will display:

      "Text 3"

       

      Any thoughts??

        • 1. Re: Text display based on frame number expression help one
          Rick Gerard Adobe Community Professional & MVP

          If statements tied to time or markers. I use markers all the time. Here's an expression that uses marker Description to generate text:

           

          m = thisComp.layer("Caption Audio").marker;
          n = 0;
          if (m.numKeys > 0){
            n = m.nearestKey(time).index;
            if (m.key(n).time > time) n--;
          }
          (n > 0) ? m.key(n).comment : ""
          

           

          Just create a layer called "Caption Audio" and set markers then add your text to the markers.

           

          I use this to add subtitles all the time.

          1 person found this helpful
          • 2. Re: Text display based on frame number expression help one
            Accumind1 Level 1

            Rick,

             

            This is fantastic! A quick question...

             

            It appears that this only displays the most recently passed marker, is there any way to allow multiple markers to be simultaneously displayed for the duration described in the "Duration" attribute of the marker?

             

            For my particular project, I will have anywhere between 1 and 5-6 different simultaneous markers that need to be displayed at any given moment... with each appearing and disappearing at different times and not necessarily disappearing in the order they appeared in chronologically.

            • 3. Re: Text display based on frame number expression help one
              Mylenium Most Valuable Participant

              Yes, it's possible, but a lot more complicated. You would have to parse all markers first, calculate the times and then create a completely custom code to display the content. Simply rethink your strategy or hire someone who can write the expressions for you.

               

              Mylenium

              • 4. Re: Text display based on frame number expression help one
                Accumind1 Level 1

                Wouldn't it be possible to simply setup an if-then that stores into the first available "slot" with the marker coment, like this script does, and for the time defined in the duration attribute? IF the first slot is full still, THEN the comment gets placed in the second slot, IF it is full, it goes in the 3rd, and so on, up to a max of, say, 6 slots. It would be a matter of storing the comment in a slot only for the duration time period, then clearing the slot. and a check that looks to see if an earlier slot is empty, if it is, everything gets moved up a slot. The main difference is that would would be displaying the contents of the "slot", rather than the contents of the comment field directly...