getDimensions

Commons
stable

Calculates the scale and translation values needed to animate an overlay element from a target position. Returns offset coordinates, scale ratios (sx, sy), and a speed multiplier for large elements.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

target
requis
HTMLElement | [x: number, y: number]
The anchor target — an HTMLElement whose bounding box is used, or a [x, y] point tuple for pointer-based origins.
el
requis
HTMLElement
The overlay element that will be animated. Its bounding box and transform-origin are read to compute the animation parameters.

API

Valeur de retour

La valeur retournée par cet util.

x/y: translation offset; sx/sy: scale ratios relative to the target; speed: 1.0–1.5 multiplier applied to large elements to slow the animation.

Usage

Exemples

Extraits de code prêts à coller.

Compute overlay animation parameters

typescript