Created
September 4, 2018 02:23
-
-
Save animoplex/0909b00a78af1703062c7708ececa0ec to your computer and use it in GitHub Desktop.
Trim Decimals - After Effects Expression by Animoplex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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