Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Convert F Temperature to Centigrade AND round off to 1 decimal place

  • Convert F Temperature to Centigrade AND round off to 1 decimal place

    Posted by Joseph Urso on January 14, 2016 at 7:06 pm

    I’m trying take a value from a slider control for a Fahrenheit temperature, convert it to Celsius and round it off to 1 decimal place. Converting the temperature is no problem using this formula:

    value = (PICKWHIP TO FARENHEIT SLIDER)-32)*(5/9);

    but it returns 12 decimal places (or none if it is an even number). I’ve tried several expressions from this forum to round off to 1 decimal place, but they always return incorrect math results. Any suggestions on how to proceed?

    Joseph Urso replied 10 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 14, 2016 at 7:33 pm

    If it’s for a text layer, you could do it like this:

    s = effect(“Slider Control”)(“Slider”);
    ((s-32)*(5/9)).toFixed(1);

    If not, you could try this:

    s = effect(“Slider Control”)(“Slider”);
    Math.round((s-32)*(5/9)*10)/10;

    Dan

  • Joseph Urso

    January 15, 2016 at 5:58 am

    The first one worked perfectly. Thank you very much for the help.

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