rectToRect
The translation and scale that put one rectangle exactly on another, for animating or fitting
between two boxes. An axis where from has no extent is only translated (scale 1).
Available since v3.1.10
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
from | Rect | The rectangle to move |
to | Rect | The rectangle to reach |
Returns
Section titled “Returns”Matrix — The matrix that maps from onto to
Examples
Section titled “Examples”Put one box on another
Section titled “Put one box on another”The matrix scales and moves the first rectangle exactly onto the second.
Related Types
Section titled “Related Types”Matrix
Section titled “Matrix”A 2D affine transformation, in the layout of CSS and SVG matrix(a, b, c, d, e, f):
An axis-aligned rectangle: its top-left corner and its size. Width and height are expected to be non-negative.
