Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding several text animation options to a dropdown control

  • Adding several text animation options to a dropdown control

    Posted by Perry Sheppard on July 12, 2020 at 6:52 pm

    I have a project set up with a number of text layers. I needed to provide alignment (left, center, right) options, so every text layer has become three layers, so the dropdown control can select between them.

    I added an option for selecting different text animation styles ( the animations are text layer animators) and I’m using a dropdown expression controller. The typical way to turn these on and off is by using Opacity 100 or 0, but I’ve realized that’s not going to work in this case.

    Is there a way to use animators (or something else) within a text layer to accomplish this? I’d prefer not to start adding duplicate layers for every animation choice because the final total on even 3 animation options would end up being 27 (3 layers, 3 alignments, 3 animations).

    I can get the result I want by turning the animator visibility on and off, but from what I understand, it’s not possible to use layer.active in an expression.

    Perry Sheppard replied 5 years, 10 months ago 2 Members · 5 Replies
  • 5 Replies
  • Perry Sheppard

    July 12, 2020 at 7:15 pm

    My other thought was to use the single animator and define multiple animations within it using an expression and if/else statements.

    The code below defines the first animator only and is in the ‘Offset’ property in the range selector. I would need to add a fair bit of code in a number of properties to make this work with multiple selectors, but if that’s the only way to accomplish this, then I’ll look take a stab at it.

    If anyone has suggestions on a simpler way using multiple animators, please let me know.

    //define timing for animators

    mySlideStart = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("SlideStart")("SlideStart" + " " + thisComp.name));
    startTimeText = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("Text1Start")("Text1Start" + " " + thisComp.name)); //only need to change these values for new layers
    endTimeText = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("Text1End")("Text1End" + " " + thisComp.name)); //only need to change these values for new layers
    mySlideEnd = (comp("Master").layer("SlideContent2.csv")("Data")("Outline")("SlideEnd")("SlideEnd" + " " + thisComp.name));

    transitionLength1 = 2; //this changes based on the animator
    transitionLength2 = 0.5; //this changes based on the animator

    value1 = -40; //this changes based on the animator
    value2 = 100; //this changes based on the animator
    value3 = 100; //this changes based on the animator
    value4 = 100; //this changes based on the animator

    t1 = startTimeText; //textStart
    t2 = startTimeText + transitionLength1; //textIn
    t3 = endTimeText - transitionLength2; //textOut which aren't needed because the out timing is the slide out not the text out
    t4 = endTimeText; //textEnd which aren't needed because the out timing is the slide out not the text out
    t5 = mySlideStart; //slideOn
    t6 = mySlideEnd - transitionLength2; //slideOut start the slide out transition
    t7 = mySlideEnd; //slideOff

    //end timing for animator definitions

    //if statement for timing

    if (time < t1 + transitionLength1) {
    linear(time, t1, t2, value1, value2) //the first transition

    } else if (time < t4 - transitionLength2) {
    linear(time, t2,t3, value2, value3); // hold at key 2

    } else {
    easeOut(time, t6, t7, value3, value4)
    }

  • Filip Vandueren

    July 12, 2020 at 9:23 pm

    What is the difference between the animators?
    Do they control entirely different properties ? (One is a scale in, two move in, 3 fade ?)
    Or just differences in timing – speed?

  • Perry Sheppard

    July 12, 2020 at 9:41 pm

    Hi Filip,

    You probably noticed I got the timing expression working. Thanks for the help and teaching me the value of time (bad pun, but it was right there).

    The animators are controlling several properties and not all are shared. I anticipate that if I go the route of writing all of the animations out using a single ‘animator’ and switching with dropdowns that it’s going to require a fair bit of code gymnastics, but if that’s my only option, then I’ll do it.

    My thought was that I would set expressions out for all of the properties needed across all of the animations and for those properties that didn’t need to be change for specific animations, I would simply apply the ‘value’ or default values to them.

  • Filip Vandueren

    July 13, 2020 at 8:45 am

    Use several animators for the different styles.

    Animate each of them with your expressions on Range Start/End/Offset
    (Although I’d personally find it more intuitive to design/animate with keyframes,
    and then use valueAtTime(), but we’ve had that discussion ?)

    At Amount=0 a Range-selector (and thus the animator) acts as if it isn’t there.
    So we only need an expression for the Range’s “Amount”-property:


    effect("Dropdown Menu Control")("Menu").value == 1 ? value : 0;

    ==1 for the first animator, ==2 for the second etc.

    That’s more compact than giving a similar expression to each and every property inside of every animator (though that would work too)

  • Perry Sheppard

    July 13, 2020 at 11:23 pm

    Thanks Filip. That worked like a charm! I entirely forgot about the ‘amount’ attribute (still learning). This was exactly what I was looking for. I’ve provided a few animation choices and it’s working perfectly. Fortunately, most of the animations only modify a single attribute, so it keep the code copying to a minimum.

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