Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change Calendar Dates With Expression for Source Text

  • Change Calendar Dates With Expression for Source Text

    Posted by Quest Rogers on August 4, 2016 at 8:15 pm

    Hello,

    I’m working on a calendar template for my job and thought I’d look for a solution here for help on making it easier for editors to use. I’d like to make a calendar template where the grid of dates change up or down in ascending order based on one layer’s source text. For example, the first layer’s/number’s source text would be 1 ( for the 1st of whatever month) and I want all numbers after that to automatically change in value to be one value greater than the number/layer before it going no higher than 31.

    I’m also thinking if a number would calculate to be higher than 31 or less than 1 their opacity would automatically be changed to 0% or off.

    I can’t think of how to write this and don’t know if it’s even possible. Hopefully my question isn’t too confusing. Does anyone have any ideas on how I’d accomplish this? I’d very much appreciate any help or ideas.

    Quest Rogers replied 9 years, 9 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 4, 2016 at 8:49 pm

    You could play around with something like this:

    refLayer = 1;
    myNum = index – thisComp.layer(refLayer).index + 1;
    myNum <= 31 ? myNum : “”

    Dan

  • Quest Rogers

    August 4, 2016 at 10:40 pm

    Thanks Dan. I appreciate you getting me started with this. I played with the expression you gave me. I understand it’s based on layer order in my comp. But how would I structure it so the value of the layers after the first one change based on the source text of the first layer and not layer order in my comp?

    For example, I have two text layers in my comp that are both the number “3”. I want the first layer or my “Driver” layer’s source text to drive up or down the source text of the second layer while adding or subtracting 1.

    So in this case since the “Driver” layer is “3” I want to the second text layer to change to “4” automatically. If I change the “Driver” layer to “2” I want to second layer to automatically change to “3”, etc.

    I imagine this would start with something like “if” and takes whatever the source text is of my Driver layer while adding a value of one to that on the text layer I want to change. Correct?

  • Dan Ebberts

    August 4, 2016 at 10:48 pm

    Maybe more like this:

    txt = thisComp.layer(index-1).text.sourceText;
    n = parseInt(txt,10);
    if (! isNaN(n)) n+1 else “”

    Dan

  • Quest Rogers

    August 5, 2016 at 12:41 pm

    Thanks again Dan! I’ll try this one out over the next couple days. Have a great weekend!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy