27 KiB
27 KiB
title, excerpt, layout
| title | excerpt | layout |
|---|---|---|
| fromInches | Converts a number from inches to the current default unit. | manual |
Converts a number from inches to the current default unit.
No matter what units the current file uses, this function will always return a number equivalent to the input in inches.
For example, if the current file uses inches, fromInches(1) will return 1. If the current file uses millimeters, fromInches(1) will return 25.4.
Caution: This function is only intended to be used when you absolutely MUST have different units in your code than the file settings. Otherwise, it is a bad pattern to use this function.
We merely provide these functions for convenience and readability, as fromInches(10) is more readable that your intent is "I want 10 inches" than 10 * 25.4, if the file settings are in millimeters.
fromInches(input: number): number
Tags
units
Arguments
| Name | Type | Description | Required |
|---|---|---|---|
input |
number |
Yes |
Returns
Examples
totalWidth = fromInches(10)