Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Expression to adjust the value of an effect depending on the number of letters

  • Expression to adjust the value of an effect depending on the number of letters

    Posted by Finn Hitchcock on December 8, 2019 at 6:43 pm

    ​do you know how I could create an expression to -5 FOV (optics compensation) every letter I have. With the FOV starting at 173 with one letter?

    Thanks in advance ☺

    Dustbinn

    Dan Ebberts replied 6 years, 9 months ago 2 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    December 8, 2019 at 7:03 pm

    Probably something like this:

    n = comp(“Text”).layer(“text”).text.sourceText.length;
    173 – Math.max((n-1),0)*5

    Dan

  • Finn Hitchcock

    December 8, 2019 at 7:17 pm

    Hey thanks for helping out!

    It’s coming up with this error: https://imgur.com/5IifEPF

    how could I fix it?

    View post on imgur.com

  • Dan Ebberts

    December 8, 2019 at 7:25 pm

    Try it this way:

    n = thisLayer.text.sourceText.length;
    173 – Math.max((n-1),0)*5

    Dan

  • Finn Hitchcock

    December 8, 2019 at 7:32 pm

    Thanks, it’s working but I am unable to keyframe it to 0.
    Is there a work around?

  • Dan Ebberts

    December 8, 2019 at 7:54 pm

    Under what condition would you want it to be zero?

    Dan

  • Finn Hitchcock

    December 8, 2019 at 8:29 pm

    I want it to start at the expression value the keyframe to 0 ( no matter the amount of letters)
    I’ve added this to the expression, am I on the right track?

    prop = thisProperty
    firstKey = prop.key(1).time;
    n = thisLayer.text.sourceText.length;
    170 – Math.max((n-1),0)*5

    Thanks

  • Dan Ebberts

    December 8, 2019 at 8:51 pm

    You could try something like this:


    if (numKeys > 0 && time >= key(1).time){
    value
    }else{
    n = thisLayer.text.sourceText.length;
    170 - Math.max((n-1),0)*5;
    }

    Dan

  • Finn Hitchcock

    December 8, 2019 at 9:02 pm

    It’s not changing the value depending on the num of letters now 🙁

  • Dan Ebberts

    December 8, 2019 at 9:08 pm

    It should, unless the number of letters changes after the first FOV keyframe.

    Dan

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