Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions source text to slider control

  • source text to slider control

    Posted by Milos Milunovic on February 8, 2015 at 4:58 pm

    Hi,
    I’m working on a project and I need to link a source text with a slider control. Layer with text (source text) is in one composition and null layer with slider control in other compositon. basically when a type 1 in text layer I want the slider control to change to 1, 2 to 2…
    I try with pick whip but nothing hapends? Do I need tu use some expressions?
    of course I’m beginner in expressions 🙂
    can someone help?

    Azariy Krutin replied 4 years, 9 months ago 5 Members · 9 Replies
  • 9 Replies
  • Dan Ebberts

    February 8, 2015 at 5:30 pm

    Something like this maybe:

    txt = comp(“Text Comp”).layer(“Text Layer”).text.sourceText;
    if (! isNaN(parseFloat(txt)))
    parseFloat(txt)
    else
    value

    Dan

  • Milos Milunovic

    February 8, 2015 at 6:04 pm

    Thanks for replay. I will try it.

  • Milos Milunovic

    February 9, 2015 at 1:34 pm

    Thanks Dan, it worked!!!
    one more question:
    i have a Text layer, one pre-comp and one null layer in my composition. Text layer (source text) is controling the null layer with slider control where I put your expression. On precomp I added a time remap and a expreesion:
    state=thisComp.layer(“Null 72”).effect(“odelo”)(“ADBE Slider Control-0001”);
    framesToTime(state);.

    When I type 1 in text layer slider from null layer goes to frame number 1 of pre-comp.
    Question is:
    is it possible to manual control the slider? to add a Checkbox Control or something like that? basically I want to use slider control who has a expression and type a number. currently can not because of the expression.
    Thanks again for help.

  • Dan Ebberts

    February 9, 2015 at 2:36 pm

    This version will take the value of the text layer if a checkbox is on, otherwise it will take the value you enter for the slider:


    if (effect("Checkbox Control")("Checkbox").value){
    txt = comp("Text Comp").layer("Text Layer").text.sourceText;
    if (! isNaN(parseFloat(txt)))
    parseFloat(txt)
    else
    value
    }else
    value

    Dan

  • Milos Milunovic

    February 9, 2015 at 3:52 pm

    Dan, thank you a lot!!!
    both expressions work.

  • Brian Holzknecht

    February 20, 2015 at 6:07 pm

    This is awesome, I was just trying to do this the other day.

    Thanks,

    Brian Holzknecht

  • Detlef Maerz

    August 13, 2021 at 1:56 pm

    Hey Guys, how this expression should be written if i use it to control the scale parameter, wich is an array?

  • Dan Ebberts

    August 13, 2021 at 7:16 pm

    Try replacing this:

    if (! isNaN(parseFloat(txt)))

    parseFloat(txt)

    with this:

    if (! isNaN(parseFloat(txt))){

    s = parseFloat(txt);

    [s,s];

    }

  • Azariy Krutin

    August 18, 2021 at 1:35 pm

    Thank you! This worked for me

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