Skip to content

Instantly share code, notes, and snippets.

@animoplex
Created September 4, 2018 02:23
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save animoplex/0909b00a78af1703062c7708ececa0ec to your computer and use it in GitHub Desktop.
Trim Decimals - After Effects Expression by Animoplex
// Trim Decimals with toFixed() - Created by Animoplex: www.animoplex.com
// Trim to a specific number of decimal places and add zeros if the value is a whole number.
// Full Tutorial: https://www.youtube.com/watch?v=aIxnJBOhdBw
// Trim Decimals Example
value.toFixed(2) // Outputs a value of, for example, 1 as 1.00 and 1.667 as 1.66
// Text String Trim Decimals Example
parseInt(text.sourceText).toFixed(2) // Converts text to string and trims decimals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment