import { keyframes } from '@emotion/react'; import { Coordinates, Location, MaterialItem } from '@gamepark/rules-api'; import type { Locator } from '../../../locators'; /** * Configuration for the elevation arc during animation. * The elevation is applied in world coordinates (before rotation transforms). */ export interface ElevationConfig { /** * Maximum height of the arc in em units. * @default 10 */ height?: number; /** * Position of the peak in the animation (0-1). * @default 0.5 */ peak?: number; /** * Shape of the elevation curve. * - 'parabolic': smooth parabolic arc (default) * - 'linear': triangular arc with linear segments * - 'ease': uses CSS ease timing for smoother feel */ curve?: 'parabolic' | 'linear' | 'ease'; /** * Position at which the arc returns to 0 (0-1). After this point the * elevation stays at 0 for the rest of the animation — useful when the * card needs to slide flat for its final approach (e.g. landing under a * deck stack instead of dropping from above). * @default 1 */ landAt?: number; } /** * A waypoint defines an intermediate position during an animation. * @typeParam P - Player ID type * @typeParam M - Material type (unused but kept for type consistency) * @typeParam L - Location type */ export interface Waypoint
{ /** * Position in the animation timeline (0-1). * 0 = start, 1 = end, 0.5 = middle */ at: number; /** * Use a locator instance to determine the position. * The locator will be used with the provided location to compute coordinates. */ locator?: Locator
;
/**
* Location parameters to pass to the locator.
* Can be a static partial location, or a function receiving the animated item
* to derive location dynamically (e.g., to preserve coordinates from origin).
*
* @example
* // Static location
* { locator: LocationType.Panel, location: { player: nextPlayer } }
*
* // Dynamic: preserve x from item's current location
* { locator: LocationType.FaceDown, location: (item) => ({ x: item.location.x }) }
*/
location?: Partial ) => Partial {
/**
* Elevation configuration for the arc effect.
* Set to false to disable elevation (flat movement).
*/
elevation?: ElevationConfig | false;
/**
* Intermediate waypoints for the trajectory.
* Waypoints are sorted by their 'at' value automatically.
*/
waypoints?: Waypoint [];
/**
* Global CSS easing function for the animation.
* @default 'ease-in-out'
*/
easing?: string;
}
/**
* Default elevation configuration (arc of 10em at 50%).
*/
export declare const defaultElevation: ElevationConfig;
/**
* Calculate the elevation value at a given point in time.
* @param t Progress in the animation (0-1)
* @param config Elevation configuration
* @returns Elevation in em units
*/
export declare function calculateElevation(t: number, config: ElevationConfig | false | undefined): number;
/**
* Parse a transform string and extract x, y, z translations.
* This is used to interpolate between waypoints.
*/
export declare function extractTranslation(transforms: string[]): Coordinates;
/**
* Generate simple elevation keyframes for the parent div.
*
* Default behaviour (when `landAt` is omitted): a 3-keyframe arc — `from, to`
* at translateZ(0) with a single `peak%` at `translateZ(height em)`. This is
* the legacy shape; not touching it keeps every existing animation pixel-
* perfect identical.
*
* When `landAt` is provided (must be in (0, 1)): a 4-keyframe arc — rises to
* peak, descends back to 0 at `landAt`, then holds 0 until the end. Lets the
* card slide flat for its final approach (e.g. landing under a deck stack).
*/
export declare function getElevationKeyframes(config: ElevationConfig): ReturnType