UNPKG

@qyu/anim-core

Version:

Animation definition and implementation

22 lines (21 loc) 902 B
import type { Anim } from "../type/Anim.js"; import type { Anim_InferPoint } from "../type/Anim_InferPoint.js"; type UnionKeyof<T extends Object> = (T extends T ? keyof T : never); type UnionValue<T extends Object, K extends keyof any> = (T extends { [key in K]: infer O; } ? O : never); type Src_Generic = readonly { readonly [K in keyof any]: Anim<any>; }[]; type Src_PointChainMap_Children<Src extends Src_Generic> = { +readonly [K in UnionKeyof<Src[number]>]: Anim_InferPoint<UnionValue<Src[number], K>>; }; type Src_PointChainMap<Src extends Src_Generic> = AnimChainMap_Point<Src_PointChainMap_Children<Src>>; export type AnimChainMap_Point<Children extends { readonly [K in keyof any]: any; }> = { readonly ptr: number; readonly children: Children; }; export declare const anim_new_chainmap: <Src extends Src_Generic>(src: Src) => Anim<Src_PointChainMap<Src>>; export {};