/** * BlendTree -- weighted multi-state blending. * * A blend tree holds named numeric-record values with weights. * `compute()` returns the weighted average of all values. * * @module */ import type { Scope } from 'effect'; import { Effect, Stream } from 'effect'; interface BlendNodeShape { readonly value: T; readonly weight: number; } interface BlendTreeShape> { add(name: string, value: T, weight: number): void; remove(name: string): void; setWeight(name: string, weight: number): void; compute(): T; readonly changes: Stream.Stream; } /** * Creates a new BlendTree for weighted multi-state blending of numeric records. * Requires a Scope for lifecycle management of the change stream. * * @example * ```ts * const program = Effect.scoped(Effect.gen(function* () { * const tree = yield* BlendTree.make<{ x: number; y: number }>(); * tree.add('idle', { x: 0, y: 0 }, 0.3); * tree.add('active', { x: 100, y: 50 }, 0.7); * const blended = tree.compute(); // { x: 70, y: 35 } * })); * ``` */ declare function _make>(): Effect.Effect, never, Scope.Scope>; /** * BlendTree -- weighted multi-state blending for numeric records. * Add named nodes with values and weights, then compute the weighted average. * * @example * ```ts * const program = Effect.scoped(Effect.gen(function* () { * const tree = yield* BlendTree.make<{ opacity: number }>(); * tree.add('fadeIn', { opacity: 1 }, 0.8); * tree.add('fadeOut', { opacity: 0 }, 0.2); * const result = tree.compute(); // { opacity: 0.8 } * })); * ``` */ export declare const BlendTree: { make: typeof _make; }; export declare namespace BlendTree { /** Structural shape of a blend-tree instance: `sample(weights)` over a `Record` space. */ type Shape> = BlendTreeShape; /** Individual leaf/intermediate node in a blend tree. */ type Node = BlendNodeShape; } export {}; //# sourceMappingURL=blend.d.ts.map