Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions String as keyframable input

  • String as keyframable input

    Posted by Andrey Khvostenko on August 12, 2015 at 3:01 pm

    Hi, community!

    I’m working on a lip–syncing rig and looking for a way to have letters as an input, which I could keyframe over time.
    The goal ist to be able to do something like that:


    var n = thisComp.layer("cntrl").effect("??????")("??????");

    if (n==a){
    ax=100;
    ay=200;
    }

    if (n==b){
    ax=200;
    ay=200;
    }

    if (n==3){
    ax=300;
    ay=200;
    }

    if (n==c){
    ax=500;
    ay=200;
    }else{};

    if (n==4){
    ax=400;
    ay=200;
    }

    [ax,ay];

    Is there any effect which offers me that option to keyframe text?
    Thanks!!

    Kalleheikki Kannisto replied 10 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    August 12, 2015 at 6:13 pm

    Why not use a text layer?

    Dan

  • Kalleheikki Kannisto

    August 13, 2015 at 10:54 am

    I believe you want to find out what the character at a given index in the text is.

    Here’s a way to extract a character at a given position in a string, if you have a layer named “control” with a slider control named “index of” and a text layer named text.

    n = Math.round(thisComp.layer("control").effect("index of")("Slider"));
    string=thisComp.layer("Text").text.sourceText;
    string[n]

    If you apply that to the source text of another text layer you get the character at the index given by the slider value.

  • Andrey Khvostenko

    August 13, 2015 at 11:06 am

    It’s not really adressing my problem. I’ll remember it for the future though. 🙂
    Thank you a lot!
    & have a great day 🙂

  • Andrey Khvostenko

    August 13, 2015 at 11:09 am

    Hey! That’s a solution! Thanks!

  • Kalleheikki Kannisto

    August 13, 2015 at 11:18 am

    Looks like you’ll have to add a Math.max expression to ensure it doesn’t go over the number of characters in the string or it will throw an error.

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