@ssgoi/core
Version:
Core animation engine for SSGOI - Native app-like page transitions with spring physics
47 lines • 1.87 kB
TypeScript
import { SpringConfig, AnimationController, AnimationState } from '../types';
export interface AnimationOptions<TAnimationValue = number> {
from: TAnimationValue;
to: TAnimationValue;
spring: SpringConfig;
onUpdate: (value: TAnimationValue) => void;
onComplete: () => void;
onStart?: () => void;
}
/**
* New Animator implementation using Popmotion
* Provides spring-based animations with fine control
* Supports both number and object animations
*
* @template TAnimationValue - The type of value being animated (number | object)
*/
export declare class Animator<TAnimationValue = number> implements AnimationController<TAnimationValue> {
private options;
private currentValue;
private velocity;
private isAnimating;
private controls;
private animationMap;
private activeAnimations;
private completedAnimations;
private updatedProperties;
constructor(options: Partial<AnimationOptions<TAnimationValue>>);
private animate;
private animateObject;
forward(): void;
backward(): void;
reverse(): void;
private shouldReverse;
stop(): void;
getVelocity(): TAnimationValue extends number ? number : Record<string, number>;
getCurrentValue(): TAnimationValue;
getIsAnimating(): boolean;
getCurrentState(): AnimationState<TAnimationValue>;
setVelocity(velocity: TAnimationValue extends number ? number : Record<string, number>): void;
setValue(value: TAnimationValue): void;
updateOptions(newOptions: Partial<AnimationOptions<TAnimationValue>>): void;
static fromState<TAnimationValue = number>(state: {
position: TAnimationValue;
velocity: TAnimationValue extends number ? number : Record<string, number>;
}, newOptions: Partial<AnimationOptions<TAnimationValue>>): Animator<TAnimationValue>;
}
//# sourceMappingURL=index.d.ts.map