Skip to content

Components

AspectRatioFitter

Holds a width-to-height ratio for a portrait, a map or a video plate, keeping it correctly shaped in whatever box the layout hands it, cropped or letterboxed depending on mode, instead of stretching to fit. Goes under a Canvas.

On this page

Add it

+ Add node → Aspect Rect creates a node with it already on. Already have a node for it? Add component → AspectRatioFitter.

From a script

A script on the same node writes these fields by name. AspectRatioFitter is the name to pass.

rgs
set_number("AspectRatioFitter", "ratio", 1.7777778);
set_point("AspectRatioFitter", "anchor", vec2(0.5, 0.5));

Fields

FieldScript nameKindDefaultWhat it does
Ratiorationumber, at least 0.011.7778Width divided by height.
Modemodeone of FromWidth, FromHeight, Fit, CoverFitWhich axis gives way.
Anchoranchortwo numbers (x, y), 0 to 1, step 0.01(0.5, 0.5)The point of the original box that stays put, (0,0) top-left to (1,1) bottom-right.