Perspective z Scale Factor
Compute CSS perspective scale at depth z using the used perspective distance clamped to at least 1px, rejecting points on or behind the viewer plane; distances use the same pixel units.
Description
CSS perspective changes apparent scale according to a point's depth relative to the perspective distance.
CSS perspective changes apparent scale according to a point's depth relative to the perspective distance. Approaching the viewer plane makes the projected scale grow, while a negative depth reduces it.1
Compute CSS perspective scale at depth z using the used perspective distance clamped to at least 1px, rejecting points on or behind the viewer plane; distances use the same pixel units.
When to use Perspective z Scale Factor
Use this tool to compute CSS perspective scale at depth z using the used perspective distance clamped to at least 1px, rejecting points on or behind the viewer plane; distances use the same pixel units.
Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.
How to use Perspective z Scale Factor and understand its results
- Choose the CSS values, dimensions or counts for this calculation. Supply resolved numeric measurements in matching units and the explicit reference box or writing mode where required.
- Enter perspective, z using the field table and calculation rules, then run the tool.
- Read scale, usedPerspective. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| perspective | Perspective distance | number; minimum: 0 | Required |
| z | Z | number | Required |
Enter a nonnegative perspective distance and signed z in the same pixel units. The used distance is clamped to at least 1 pixel. The point must satisfy z < usedPerspective; equality and points beyond the viewer plane are errors. The tool calculates the positive scale, using an equivalent expression if the denominator overflows, and rejects a nonfinite or nonpositive result.
usedPerspective = max(1, perspective); scale = usedPerspective / (usedPerspective − z) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| scale | Scale | number; minimum: 0 |
| usedPerspective | Used perspective | number; minimum: 1 |
{
"input": {
"perspective": 500,
"z": 250
},
"output": {
"scale": 2,
"usedPerspective": 500
}
} Limitations and assumptions
This projects one depth value rather than applying a full 3D transform. It does not compute perspective-origin, clipping, rotation or a scene's visibility. The numeric input is a perspective length, not the CSS none keyword.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use Negative scale Flip Mirror Check: Classify axis reflections, orientation reversal, and collapsed axes of a two-dimensional CSS scale. For a complementary task, use Translate % Relative To Own Box Width: Resolve a signed horizontal translate percentage against an explicitly supplied reference-box width in pixels; the caller chooses the transform reference box.
References
-
Perspective z Scale Factor — tool.io
Similar or alternative tools
- Negative scale Flip Mirror Check
Classify axis reflections, orientation reversal, and collapsed axes of a two-dimensional CSS scale.
- Translate % Relative To Own Box Width
Resolve a signed horizontal translate percentage against an explicitly supplied reference-box width in pixels; the caller chooses the transform reference box.