Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Creating a calendar template with Essential Graphics drop-down menus

  • Creating a calendar template with Essential Graphics drop-down menus

    Posted by Nicholas Deines on March 22, 2021 at 7:45 pm

    Hi all. I’ve made a calendar template. My goal is to have each square (day) in the calendar display the correct number based off two factors: the start day of the month and the month. I first wrote an expression that had each square displaying the correct number based on the chosen start day. Each number being one of 7 possibilities. That worked fine. Then I tried to create two more ranges of possibilities so that if the user chose a 31 day month like January it would go up to 31; if they chose a 30 day month, the numbers would stop at 30; and if they chose February, it would stop at 28 (I haven’t gotten to the leap year option yet). I’m trying to do this using “if else” statements. Right now, I’m not getting any errors, but it’s also not behaving as I had hoped. Below is the source text code for my 31st square. Any thoughts?

    dropMonth = thisComp.layer(“Master Controller”).effect(“Month”)(“Menu”);

    dropMenu = thisComp.layer(“Master Controller”).effect(“Start Day”)(“Menu”).value;

    StartDay = [31, 30, 29, 28, 27, 26, 25]

    StartDay2 = [“”, 30, 29, 28, 27, 26, 25]

    StartDay3 = [“”, “”, “”, 28, 27, 26, 25]

    if(dropMonth == 1, 3, 5, 7, 8, 10, 12) {

    value == StartDay;

    } else if (dropMonth = 4, 6, 9, 11) {

    StartDay2;

    } else if (dropMonth = 2){

    StartDay3;

    }

    StartDay [dropMenu – 1]

    StartDay2 [dropMenu – 1]

    StartDay3 [dropMenu – 1]

    Nicholas Deines replied 5 years, 1 month ago 3 Members · 7 Replies
  • 7 Replies
  • Terry Coolidge

    March 22, 2021 at 7:58 pm

    Just one man’s opinion, but your expressions solution seems to me like you’re trying to be too clever. There are only seven different possibilities for start dates. I would be inclined to just make seven different calendar comps, all with 31 numbers, and then mask out the “31” when appropriate (and the “30” and “29” as well for February). Maybe I’m not understanding the benefit of using expressions in this instance. Setting up seven comps, or even 21 since there are only three different month lengths (not counting leap years), isn’t so much work that it’s worth dealing with the potential of serious expression headaches.

  • Nicholas Deines

    March 22, 2021 at 8:01 pm

    This is a tool for several users. I’m trying to make things as easy as possible.

  • Terry Coolidge

    March 22, 2021 at 8:04 pm

    A folder with pre-made comps is pretty easy…

  • Walter Soyka

    March 22, 2021 at 9:54 pm

    I built a quick sample project that takes the month (as a dropdown) and the year (as a slider) and builds out the calendar. It figures out what day of the week the first day of the month falls on, and it figures out the number of days in the month programmatically, so leap years etc. are always accounted for.

    I’ve laid out numbers as text layers in the calendar squares, and put initial values of 1 through 42. The expression on each text layer subtracts one for each day of the week before the first day of the month. If the number ends up less than 1, or greater than the total number of days in that specific month, the expression replaces the text with an empty string.

    Please ask questions after you go through the project if anything is unclear!

  • Nicholas Deines

    March 22, 2021 at 10:00 pm

    Thanks, Walter. I’ll check it out.

  • Nicholas Deines

    March 25, 2021 at 7:07 pm

    I got my code to work. For some reason, I had to separate the “dropMonth” values into thirteen if/else statements, each one dedicated to a single value. I’m still not sure why the comas in the original code didn’t work. Any ideas?

    dropMonth = thisComp.layer(“Master Controller”).effect(“Month”)(“Menu”).value;

    startdayMenu = thisComp.layer(“Master Controller”).effect(“Start Day”)(“Menu”).value;

    date = [31, 30, 29, 28, 27, 26, 25]

    date2 = [“”, 30, 29, 28, 27, 26, 25]

    date3 = [“”, “”, “”, 28, 27, 26, 25]

    date4 = [“”, “”, 29, 28, 27, 26, 25]

    if(dropMonth == 1) {

    date [startdayMenu – 1];

    }else if (dropMonth == 3) {

    date [startdayMenu – 1];

    }else if (dropMonth == 5) {

    date [startdayMenu – 1];

    }else if (dropMonth == 7) {

    date [startdayMenu – 1];

    }else if (dropMonth == 8) {

    date [startdayMenu – 1];

    }else if (dropMonth == 10) {

    date [startdayMenu – 1];

    }else if (dropMonth == 12) {

    date [startdayMenu – 1];

    }else if (dropMonth == 4) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 6) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 9) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 11) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 2){

    date3 [startdayMenu – 1];

    }else if (dropMonth == 13){

    date4 [startdayMenu – 1];

    }

  • Nicholas Deines

    March 25, 2021 at 7:11 pm

    I have more variables in the calendar that rapidly multiply the number of potential results. Doing this with expressions is much more desirable for my end users.

    I got the code to work. I had write individual if/else statements for the “dropMonth” values. I can’t figure out why it didn’t like the values when separated by commas.

    dropMonth = thisComp.layer(“Master Controller”).effect(“Month”)(“Menu”).value;

    startdayMenu = thisComp.layer(“Master Controller”).effect(“Start Day”)(“Menu”).value;

    date = [31, 30, 29, 28, 27, 26, 25]

    date2 = [“”, 30, 29, 28, 27, 26, 25]

    date3 = [“”, “”, “”, 28, 27, 26, 25]

    date4 = [“”, “”, 29, 28, 27, 26, 25]

    if(dropMonth == 1) {

    date [startdayMenu – 1];

    }else if (dropMonth == 3) {

    date [startdayMenu – 1];

    }else if (dropMonth == 5) {

    date [startdayMenu – 1];

    }else if (dropMonth == 7) {

    date [startdayMenu – 1];

    }else if (dropMonth == 8) {

    date [startdayMenu – 1];

    }else if (dropMonth == 10) {

    date [startdayMenu – 1];

    }else if (dropMonth == 12) {

    date [startdayMenu – 1];

    }else if (dropMonth == 4) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 6) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 9) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 11) {

    date2 [startdayMenu – 1];

    }else if (dropMonth == 2){

    date3 [startdayMenu – 1];

    }else if (dropMonth == 13){

    date4 [startdayMenu – 1];

    }

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