import { Interpolation, Theme } from '@emotion/react'; import { Animation } from '@gamepark/react-client'; import { Coordinates, GridBoundaries, ItemMove, MaterialMove } from '@gamepark/rules-api'; import { ItemContext, Locator } from '../../../locators'; import { MaterialSoundConfig } from '../sound'; import { ItemAnimations } from './ItemAnimations'; import { MaterialAnimationContext, MaterialGameAnimationContext } from './MaterialGameAnimations'; import { ElevationConfig, Trajectory, Waypoint } from './Trajectory'; /** * Predicate function to determine if an animation configuration applies to a move. */ export type AnimationPredicate

= (move: MaterialMove, context: MaterialAnimationContext) => boolean; /** * Fluent builder for configuring animations. * Use this to define duration, sound, and trajectory for animations. */ export declare class AnimationBuilder

extends ItemAnimations { /** @internal Predicates to match moves */ readonly predicates: AnimationPredicate[]; /** @internal Duration in seconds */ private _duration?; /** @internal Sound configuration */ private _sound?; /** @internal Trajectory configuration */ private _trajectory; /** @internal Whether this animation plays after the move is applied */ private _postMove; /** @internal Custom item animation function */ private _itemAnimation?; /** * Add a predicate to filter which moves this configuration applies to. * All predicates must return true for the configuration to apply. */ filter(predicate: AnimationPredicate): this; /** * Set the animation duration in milliseconds. * @param ms Duration in milliseconds */ duration(ms: number): this; /** * Get the configured duration in seconds. */ get durationSeconds(): number | undefined; /** * Set the sound to play during the animation. * @param sound Sound file path, configuration object, or false to disable */ sound(sound: string | MaterialSoundConfig | false): this; /** * Get the sound configuration. */ get soundConfig(): string | MaterialSoundConfig | false | undefined; /** * Set a custom item animation function. * This overrides the default position-based animation with fully custom keyframes. * @param fn Function that returns CSS animation for each item */ itemAnimation(fn: (context: ItemContext, animation: Animation>, boundaries: GridBoundaries) => Interpolation): this; /** * Skip this animation entirely (duration = 0). */ skip(): this; /** * Make this animation play after the move is applied (AFTER_MOVE step). * By default, animations play before the move (BEFORE_MOVE step). * Useful for animating items that become visible only after the move. */ postMove(): this; /** * Configure a complete trajectory with elevation and waypoints. * @param config Trajectory configuration */ trajectory(config: Trajectory | ((context: ItemContext, move: MaterialMove) => Trajectory)): this; /** * Get the trajectory configuration. */ get trajectoryConfig(): Trajectory | ((context: ItemContext, move: MaterialMove) => Trajectory); /** * Configure the elevation arc. * @param heightOrConfig Height in em, or full configuration object */ arc(heightOrConfig?: number | ElevationConfig): this; /** * Disable elevation (flat movement). */ flat(): this; /** * Add a waypoint to pass through during the animation. * @param locatorOrCoordinates Locator instance or absolute coordinates * @param at Position in animation (0-1), default 0.5 */ via(locatorOrCoordinates: Locator | Coordinates, at?: number): this; via(waypoint: Waypoint): this; /** * Add multiple waypoints to pass through. * @param waypoints Array of waypoints */ through(...waypoints: Waypoint[]): this; /** * Set the global easing function for the animation. * @param easing CSS easing function */ easing(easing: string): this; /** * Apply a mutation to the trajectory configuration. When the trajectory has * been set to a function (dynamic trajectory), the mutation is composed on * top of the function's result so chaining `.via()`, `.flat()`, etc. after * `.trajectory(fn)` correctly augments the dynamic trajectory instead of * silently discarding it. */ private updateTrajectory; /** * Check if this configuration matches a move. * @internal */ matches(move: MaterialMove, context: MaterialAnimationContext): boolean; /** * Get the duration for this animation. * @internal */ getDuration(move: MaterialMove, context: MaterialGameAnimationContext): number; /** * Get the item animation CSS. * @internal */ getItemAnimation(context: ItemContext, animation: Animation>, boundaries: GridBoundaries): Interpolation; } /** * Create a predicate that matches moves by the current player. */ export declare function isMyMove

(): AnimationPredicate; /** * Create a predicate that matches moves during a specific rule. * @param ruleId The rule ID to match */ export declare function isRule

(ruleId: number): AnimationPredicate; /** * Create a predicate that matches moves for a specific material type. * @param materialType The material type to match */ export declare function isMaterial

(materialType: M): AnimationPredicate; /** * Create a predicate that matches a specific item move type. * @param moveType The item move type to match */ export declare function isMoveType

(moveType: ItemMove['type']): AnimationPredicate; /** * Create a predicate that matches moves from a specific location type. * @param locationType The source location type to match */ export declare function isFromLocation

(locationType: L): AnimationPredicate; /** * Create a predicate that matches moves to a specific location type. * @param locationType The destination location type to match */ export declare function isToLocation

(locationType: L): AnimationPredicate; /** * Combine predicates with AND logic (all must match). */ export declare function and

(...predicates: AnimationPredicate[]): AnimationPredicate; /** * Combine predicates with OR logic (any must match). */ export declare function or

(...predicates: AnimationPredicate[]): AnimationPredicate; /** * Negate a predicate. */ export declare function not

(predicate: AnimationPredicate): AnimationPredicate;