Values
Value bags: Values, a flat map of keys to numbers or strings, the shape every animation target
takes, and what a binding does with one as it builds an animation: split it by kind, and pick
from it.
import * as Values from "@wardic/core/Values"
const { numbers, strings } = Values.split({ x: 100, opacity: 1, color: "#a3be8c" })
// numbers: { x: 100, opacity: 1 }, which a spring moves; strings: { color: "#a3be8c" }, blendedInterfaces
Split
A bag's keys by kind: its numbers, which a spring moves, and its strings, which are blended by a progress.
Properties
numbers
readonly numbers: Record<string, number>;Its keys that hold a number.
strings
readonly strings: Values;Its keys that hold a string.
Type Aliases
Values
type Values = Record<string, number | string>;A flat bag of values: numbers, or strings an Environment blends, such as "12px" or a colour.
Variant
type Variant = Record<string, number | string>;A named animation state's values.
Variants
type Variants = Record<string, Variant>;Named animation states, which the elements of a component tree share by name.
Variables
pick
const pick: {
(keysFrom): (self) => Values;
(self, keysFrom): Values;
};self's values for the keys keysFrom has, leaving out a key self lacks or holds undefined for:
where an animation's keys start, from the element's values for the keys it animates to.
Call Signature
(keysFrom): (self) => Values;Parameters
keysFrom
Readonly<Values>
Returns
(self) => Values
Call Signature
(self, keysFrom): Values;Parameters
self
Readonly<Values>
keysFrom
Readonly<Values>
Returns
Example
const from = Values.pick(current, target) // current's values for target's keysFunctions
split()
function split(values): Split;values' keys by kind: its numbers and its strings. A key holding neither, an undefined that reached
the bag at run time, is in neither.
Parameters
values
Readonly<Values>