MotionScript

@motion-script/core


@motion-script/core / ImageCrop

Type Alias: ImageCrop

ImageCrop = Insets

Defined in: attributes/shape/fill/implementations/image.ts:43

A rectangular window onto the source, as fractions of the source's own size (0–1) inset from each edge: { left: 0.25 } discards the left quarter.

Fractions rather than pixels so a crop is resolution-independent — the same value reads identically at 1× and 4K, and survives swapping src for a differently-sized asset. Everything downstream (fit, zoom, anchor) then treats the cropped window as if it were the whole image, so a crop composes with the fit modes instead of fighting them.

Reuses the Insets shape, so the shorthands come free — and so do resolveInsets/lerpInsets, which is what makes a crop tween: 0.1 · { horizontal: 0.2 } · { left: 0.1, top: 0.05 }.