Skip to main content

Function: Percent()

Percent(axis, value): number

Defined in: src/utils/unit.ts:52

Convert a percentage of the frame size along axis to scene units. The X axis (RIGHT) uses the frame width, the Y axis (UP) uses the frame height. Mirrors ManimCE Percent.

Parameters​

axis​

Vector3Tuple

value​

number

Returns​

number

Throws​

if axis is the Z axis (OUT); its length is undefined.

Example​

Percent(RIGHT, 50); // DEFAULT_FRAME_WIDTH / 2
Percent(UP, 25); // DEFAULT_FRAME_HEIGHT / 4