WardicThree: its internal types

Type Aliases

AnyKeyTarget

type AnyKeyTarget<T, G> = { readonly [P in keyof G]: P extends "transition" ? Config.WardicTransitionFor<string> | undefined : P extends "transitionEnd" ? AnyKeyTransitionEnd<T> | undefined : AnyKeyValue<T, P & string> };

A target for T whose keys are any name (a ShaderMaterial's uniforms, a mesh drawn with one), checked key by key as given (G): transition as a transition, transitionEnd as its Transition end, and any other key as ThreeTarget gives it a value. Since any name is one of its keys, a misspelt key, even a scene object's own (rotatY), isn't caught.

Type Parameters

T

T

G

G


AnyKeyTargetFor

type AnyKeyTargetFor<T, G> = string extends TransitionKey<T> ? AnyKeyTarget<T, G> : never;

Where T's keys are any name, the target given, checked key by key (AnyKeyTarget); else nothing, a ThreeTarget its target.

Type Parameters

T

T

G

G


AnyKeyTransitionEnd

type AnyKeyTransitionEnd<T> = [SceneKey<T>] extends [never] ? (WardicObject.ObjectTarget<T> extends object ? Exclude<End, undefined> : never) & SceneTransitionEnd<UniformKey<T>, UniformColourKey<T>> : SceneTransitionEnd<SceneKey<T>, ColourKey<T>>;

The Transition end of a target for T whose keys are any name, as ThreeTarget's.

Type Parameters

T

T


AnyKeyValue

type AnyKeyValue<T, P> = [SceneKey<T>] extends [never] ? 
  | P extends keyof WardicObject.ObjectTarget<T> ? Exclude<WardicObject.ObjectTarget<T>[P], undefined> : never
  | P extends 
  | UniformKey<T>
| UniformColourKey<T> ? ValueOf<P, UniformKey<T>, UniformColourKey<T>, SceneValue, ColourTargetValue> : never : ValueOf<P, SceneKey<T>, ColourKey<T>, SceneValue, ColourTargetValue>;

The value a target for T, whose keys are any name, gives its key P: a scene's by its keys and colours, any other object's by its own keys and its uniforms'.

Type Parameters

T

T

P

P extends string


AxesOf

type AxesOf<V> = V extends object ? "X" | "Y" | "Z" | "W" : V extends object ? "X" | "Y" | "Z" : V extends object ? "X" | "Y" : never;

The axes of a three vector, by its flag: X, Y, and Z and W where it has them.

Type Parameters

V

V


BatchColourValue

type BatchColourValue = 
  | ColourStop
  | readonly [ColourStop, ColourStop]
  | ((i, n) => 
  | ColourValue
  | readonly [ColourValue, ColourValue]);

A Batch's value for a colour key: a stop, two, or a function giving them.


BatchNumberValue

type BatchNumberValue = 
  | ObjectBatch.Stop
  | readonly [ObjectBatch.Stop, ObjectBatch.Stop]
  | ((i, n) => number | readonly [number, number]);

A Batch's value for a number key: a stop, two (its first and its target), or a function giving them. @wardic/object's.


ChannelKey

type ChannelKey<K> = `${K}${typeof CHANNELS[number]}`;

A colour's channel keys, in linear light: colorR, colorG, colorB.

Type Parameters

K

K extends string


ColourKeyOf

type ColourKeyOf<T> = { readonly [K in keyof T]-?: T[K] extends IsColor ? K : never }[keyof T] & string;

T's keys that hold a three Color.

Type Parameters

T

T


ColourSegmentValue

type ColourSegmentValue = 
  | ColourValue
  | null
  | ReadonlyArray<ColourValue | null>
  | ((i, n) => 
  | ColourValue
  | null
  | ReadonlyArray<ColourValue | null>);

A Batch's colour key in a sequence's Segment of it: a colour, null for where it is, stops of them, or a function giving them.


ColourStop

type ColourStop = 
  | ColourValue
  | ((i, n) => ColourValue);

A Batch's stop of a colour: one for every member, or a function of a member's index and the count.


ColourTargetValue

type ColourTargetValue = 
  | ColourValue
| Config.WardicKeyframes<ColourValue>;

A colour key's value: a colour, or keyframes of them.


IsColor

type IsColor = object;

A three Color, by its flag.

Properties

isColor
readonly isColor: true;

IsInstancedMesh

type IsInstancedMesh = object;

An InstancedMesh, by its flag.

Properties

isInstancedMesh
readonly isInstancedMesh: true;

MaterialColourKey

type MaterialColourKey<M> = 
  | ColourKeyOf<M>
| UniformColourKey<UniformsOf<M>>;

The colour keys of M, a material: its Colors and its uniforms'.

Type Parameters

M

M


MaterialKey

type MaterialKey<M> = 
  | SceneNumberKey<M>
  | VectorKey<M>
  | ChannelKey<ColourKeyOf<M>>
| UniformKey<UniformsOf<M>>;

The number keys of M, a material: its numbers, its vectors' axes, its colours' channels, and its uniforms'.

Type Parameters

M

M


MaterialOf

type MaterialOf<T> = T extends object ? M extends ReadonlyArray<infer E> ? E : M : never;

The material a mesh's material gives it: each of an array of them.

Type Parameters

T

T


SceneNumberKey

type SceneNumberKey<T> = Exclude<{ readonly [K in keyof T]-?: T[K] extends number ? K : never }[keyof T] & string, "id">;

T's keys that hold a number, but its id, which three makes read-only.

Type Parameters

T

T


SceneTarget

type SceneTarget<K, C, E> = { readonly [Key in K | C]?: ValueOf<Key, K, C, SceneValue, ColourTargetValue> } & object;

A target for a scene's Subject, by its number keys K and its colour keys C: a transition, with an entry under any of the keys E, which animate's options are laid over field by field, and a Transition end, set once the Subject lands.

Type Parameters

K

K extends string

C

C extends string

E

E extends string

Type Declaration

transition?
readonly transition?: Config.WardicTransitionFor<E>;

How it gets there: a spring, a tween or an inertia, with an entry under any of its keys, a colour's or a channel's.

transitionEnd?
readonly transitionEnd?: SceneTransitionEnd<K, C>;

Values set once it lands, with no animation, each under a key the Subject has and three can write: one it lacks, or can't write (its id), is an error at the call, as a key it animates is. One it can no longer set by then is reported and left as it is, and the rest are set.


SceneTransitionEnd

type SceneTransitionEnd<K, C> = { readonly [Key in K | C]?: ValueOf<Key, K, C, number, ColourValue> };

A scene's Subject's Transition end, by its number keys K and its colour keys C: a number or a colour each.

Type Parameters

K

K extends string

C

C extends string


SceneValue

type SceneValue = number | Config.WardicKeyframes<number>;

A key's value in a scene: a number, or keyframes of them.


TransitionKey

type TransitionKey<T> = [SceneKey<T>] extends [never] ? 
  | WardicObject.AnimatableKey<T>
  | UniformKey<T>
  | UniformColourKey<T> : 
  | SceneKey<T>
| ColourKey<T>;

The keys a transition for T takes an entry under, each key a target for it can give: a scene object's or a material's scene keys and colours, a uniforms object's uniforms, any other object's own keys. A colour's entry runs its channels, and a channel's own entry runs it in place of its colour's.

Type Parameters

T

T


UniformColourKey

type UniformColourKey<U> = [U] extends [ReadonlyArray<unknown>] ? never : { readonly [K in keyof U]-?: U[K] extends { value: IsColor } ? K : never }[keyof U] & string;

The names of U's uniforms that hold a Color. An array has none.

Type Parameters

U

U


UniformKey

type UniformKey<U> = [U] extends [ReadonlyArray<unknown>] ? never : { readonly [K in keyof U]-?: U[K] extends { value: number } ? K : U[K] extends { value: IsColor } ? K extends string ? ChannelKey<K> : never : U[K] extends { value: infer V } ? K extends string ? `${K}${AxesOf<(...)>}` : never : never }[keyof U] & string;

The names of U's uniforms that hold a number, a vector's axes, or a colour's channels. An array has none.

Type Parameters

U

U


UniformsOf

type UniformsOf<M> = M extends object ? U : never;

The uniforms M holds, a ShaderMaterial's.

Type Parameters

M

M


ValueOf

type ValueOf<Key, K, C, N, Colour> = Key extends C ? Key extends K ? N | Colour : Colour : N;

A key's value among number keys K and colour keys C: either, for a key in both (a ShaderMaterial's uniforms, which three types as any name of any value).

Type Parameters

Key

Key

K

K

C

C

N

N

Colour

Colour


VectorKey

type VectorKey<T> = { readonly [K in keyof T]-?: K extends string ? `${K}${AxesOf<T[K]>}` : never }[keyof T];

T's vectors' axes as keys: positionX, uOffsetY.

Type Parameters

T

T