motion#

Interfaces#

Travel#

Defined in: arranger/src/motion.ts:82

A travel in a drawing’s units.

Properties#

x#

readonly x: number

Defined in: arranger/src/motion.ts:83

y#

readonly y: number

Defined in: arranger/src/motion.ts:84

Type Aliases#

Matrix#

Matrix = Pick<DOMMatrixReadOnly, "a" | "b" | "c" | "d" | "e" | "f">

Defined in: arranger/src/motion.ts:12

The six numbers of a 2D matrix, as an element’s getScreenCTM() returns them.

Variables#

CUBIC_OUT#

const CUBIC_OUT: "cubic-bezier(0.33, 1, 0.68, 1)" = "cubic-bezier(0.33, 1, 0.68, 1)"

Defined in: arranger/src/motion.ts:88

cubicOut as a CSS timing function, for the Web Animations a settle runs.

Functions#

drawingMatrix()#

drawingMatrix(element): Matrix | null

Defined in: arranger/src/motion.ts:37

The screen CTM of the <svg> an element is drawn in, whose user units are the drawing’s. Unlike the element’s own, it is never moved by slide nor by a reorder, so a pointer read through it stays where the drawing is.

Parameters#

element#

SVGElement

Returns#

Matrix | null


offsetIn()#

offsetIn(matrix, dx, dy): { x: number; y: number; } | null

Defined in: arranger/src/motion.ts:25

The drawing-unit offset that moves an element by (dx, dy) screen pixels: the inverse of the linear part of its screen CTM, the translation left out. null when the matrix cannot be inverted (an element drawn at no size).

Parameters#

matrix#

Matrix

dx#

number

dy#

number

Returns#

{ x: number; y: number; } | null


pointIn()#

pointIn(matrix, x, y): { x: number; y: number; } | null

Defined in: arranger/src/motion.ts:42

The point in an element’s user units under the screen point (x, y).

Parameters#

matrix#

Matrix

x#

number

y#

number

Returns#

{ x: number; y: number; } | null


screenMatrix()#

screenMatrix(element): Matrix | null

Defined in: arranger/src/motion.ts:15

An element’s screen CTM; null for an element that is not drawn or has none.

Parameters#

element#

Element

Returns#

Matrix | null


settle()#

settle(element, from, to, done): () => void

Defined in: arranger/src/motion.ts:101

Move element, drawn in a block’s drawing, from the drawing-unit travel from to to, as slide moves a reordered element: over √d × 120 ms, d the screen distance between them (through the drawing’s screen CTM), easing out. The element’s own transform attribute is meant to hold from, where it lies until the motion starts on the next animation frame: so the first frame painted after the call shows it there in every engine, however an engine dates the start of an animation made between two frames. The motion holds to once it ends; done runs then. The function returned stops the motion, started or not.

Parameters#

element#

SVGElement

from#

Travel

to#

Travel

done#

() => void

Returns#

() => void


slide()#

slide(node, __namedParameters, params?): AnimationConfig

Defined in: arranger/src/motion.ts:59

An animate: function for the elements of a block’s drawing: on a keyed reorder, each element slides from where it was to where it now is. Svelte measures both places as screen rectangles; flip would apply their offset as CSS pixels, which inside the scaled SVG are drawing units, so this converts the offset through the element’s screen CTM. Only the position moves; an element keeps its size on a reorder.

duration is in milliseconds, or a function of the screen distance in pixels (by default √d × 120, as flip’s); the block node passes 0 whenever its elements are not to slide. No animation when the element has no screen CTM.

Parameters#

node#

Element

__namedParameters#
from#

DOMRect

to#

DOMRect

params?#

FlipParams = {}

Returns#

AnimationConfig