VistaHiresTransition Class
The VistaHiresTransition class manages smooth animated transitions when images are loaded or when dimensions/positions change.
Overview
Section titled “Overview”VistaHiresTransition provides:
- Smooth easing animations for size and position changes
- Concurrent animation management
- Frame-by-frame state interpolation
- Animation cancellation
Use Case: Used internally by VistaImage to animate dimension and transform changes. Typically not used directly by applications.
Public Properties
Section titled “Public Properties”None - all properties and map are private/static.
Public Static Methods
Section titled “Public Static Methods”start()
Section titled “start()”static start(options: { vistaImage: VistaBox; onComplete: () => void; shouldWait: () => boolean; target: { width?: number; height?: number; transform?: { x?: number; y?: number; scale?: number }; translate?: { x?: number; y?: number }; };}): voidStarts an animated transition for a VistaBox instance.
Parameters:
vistaImage- The VistaBox instance to animateonComplete- Callback when animation completesshouldWait- Function returningtrueto pause animationtarget- Target dimensions and transformations to animate to
Example:
import { VistaHiresTransition } from 'vistaview';
VistaHiresTransition.start({ vistaImage: image, onComplete: () => console.log('Animation complete'), shouldWait: () => false, target: { width: 800, height: 600, transform: { scale: 1.5, x: 0, y: 0 }, },});stop()
Section titled “stop()”static stop(vistaImage: VistaBox): VistaHiresTransitionOpt | undefinedStops an active animation for a VistaBox instance.
Parameters:
vistaImage- The VistaBox instance
Returns: The animation state at the time of stopping, or undefined if no animation was running
Example:
const state = VistaHiresTransition.stop(image);if (state) { console.log('Stopped at:', state.current);}Animation Behavior
Section titled “Animation Behavior”- Uses easing function (20% of remaining distance per frame) for smooth motion
- Stops when values are within threshold (1px for position, 0.005 for scale)
- Handles multiple concurrent animations per instance
- Respects
shouldWaitcallback to pause during rapid navigation
Related
Section titled “Related”- VistaBox - Container class that uses transitions
- VistaImage - Image class that triggers transitions
- VistaView - Main controller