Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to use Javascript text decimal only retains the single digit?

  • How to use Javascript text decimal only retains the single digit?

    Posted by Ming Hsu on January 5, 2023 at 11:59 am

    I wrote a number addition,

    As long as there are more than ten digits, the following single digits are reserved.

    Y =

    thisComp.layer(“QiuCards_ 4”).essentialProperty(“B_Dot_”)+

    thisComp.layer(“QiuCards_ 4”).essentialProperty(“TopDot_”)+

    thisComp.layer(“QiuCards_ 5”).essentialProperty(“B_Dot_”)+

    thisComp.layer(“QiuCards_ 5”).essentialProperty(“TopDot_”)

    if (Y > 10){

    value = Y – 10;

    }else if(Y < 10){

    value = Y;

    }
    ———————————-
    When i number addition greater than 20.
    it’s doesn’t work,
    my text will be come decimal number.

    Ming Hsu replied 3 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 5, 2023 at 5:30 pm

    It’s hard to picture what you’re describing. Can you maybe post some screenshots?

  • Ming Hsu

    January 6, 2023 at 2:55 am

    Thank u Dan.

    i solved it!!
    In the end i put this script.

    (“0” + Y ).slice(-1);
    ——————————

    Here’s a little game where I’m making a template.

    The sum of the points of the two cards exceeds 10.
    Only look at single digit numbers.The maximum is 9 and the minimum is 0.


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