MeasuredPair
Measured pairs: a key that places or sizes the box, whose two ends are lengths of different types,
"auto" against px, "50%" against a number, a calc(), can't blend as written. Both ends are
measured in px at the end of the task that asks, as Motion's are, so the animation runs between them
and lands on its target as given.
import * as MeasuredPair from "@wardic/dom/MeasuredPair"
MeasuredPair.needs("width", "auto", 200) // true
MeasuredPair.needs("opacity", 0, 1) // falseInterfaces
Measured
One Measured pair its batch has read: as asked, with each end in px.
Extends
Properties
from
readonly from: string | number;Its start, as given.
Inherited from
fromPx
readonly fromPx: number;Its start in px.
key
readonly key: string;The key.
Inherited from
to
readonly to: string | number;Its target, as given.
Inherited from
toPx
readonly toPx: number;Its target in px.
Requested
One Measured pair as asked for: its key, and its ends as given.
Extended by
Properties
from
readonly from: string | number;Its start, as given.
key
readonly key: string;The key.
to
readonly to: string | number;Its target, as given.
Functions
measure()
function measure(
element,
pairs,
values
): Readonly<Record<string, Requested>>;Measures pairs on element at the end of this task, with every other element's in the same batch:
each pair, as asked, measured before the next tick. values are what the element draws now,
its other transforms among them.
Parameters
element
HTMLElement
pairs
Readonly<Record<string, {
from: number | string;
to: number | string;
}>>
values
Values
Returns
Readonly<Record<string, Requested>>
measured()
function measured(pair): Option<Measured>;pair with its px, once its end-of-task batch has read both its ends: none before that batch, and
none if it couldn't read one, which the animation takes as a switch.
Parameters
pair
Returns
Option<Measured>
needs()
function needs(
key,
from,
to
): boolean;Whether key from from to to needs measuring, a Measured pair: a key that can be measured, whose
two ends are lengths, auto or a calc(), of different types. Two of one type blend as ever.
Parameters
key
string
from
string | number
to
string | number
Returns
boolean