FORUMS: list search recent posts

Change Calendar Dates With Expression for Source Text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Quest Rogers
Change Calendar Dates With Expression for Source Text
on Aug 4, 2016 at 8:15:03 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.


Return to posts index

Dan Ebberts
Re: Change Calendar Dates With Expression for Source Text
on Aug 4, 2016 at 8:49:54 pm

You could play around with something like this:

refLayer = 1;
myNum = index - thisComp.layer(refLayer).index + 1;
myNum <= 31 ? myNum : ""


Dan



Return to posts index

Quest Rogers
Re: Change Calendar Dates With Expression for Source Text
on Aug 4, 2016 at 10:40:36 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?


Return to posts index


Dan Ebberts
Re: Change Calendar Dates With Expression for Source Text
on Aug 4, 2016 at 10:48:11 pm

Maybe more like this:

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


Dan



Return to posts index

Quest Rogers
Re: Change Calendar Dates With Expression for Source Text
on Aug 5, 2016 at 12:41:14 pm

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


Return to posts index

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