Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Slider (Decimal) to Binary

  • Slider (Decimal) to Binary

  • Andy Benham

    January 22, 2021 at 12:50 pm

    Hello all,

    I would like to control a text layer to read a padded 10-bit binary number, ideally controlled by a slider.

    0 Decimal = 0000000000

    512 Decimal = 10000000000

    1024 Decimal = 1111111111

    I can’t find any expressions that would work to do this, although I imagine it should be quite trivial, I can’t imagine nobody has ever needed to do this before?

    Suggestions welcome.

  • Othman Ahmed

    January 22, 2021 at 1:09 pm

    Yup, it’s pretty easy. just add this code to the source text of the text layer :

    decimal = thisComp.layer("slider controller").effect("Slider Control")("Slider");


    // done by VFXING

  • Andy Benham

    January 22, 2021 at 1:19 pm

    That’s perfect, thank you 🙂

    Any suggestions on how to pad to 10 bits?

  • Filip Vandueren

    January 22, 2021 at 1:43 pm

    That would be:

    decimal=effect("Slider Control")("Slider").value;
    binary = decimal.toString(2).padStart(10,"0");
  • Andy Benham

    January 22, 2021 at 1:50 pm

    Thank you so much both – that’s absolutely perfect.

  • Othman Ahmed

    January 22, 2021 at 2:19 pm

    You’re welcome.

Viewing 1 - 6 of 6 posts

Log in to reply.

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