Skip to content

VistaHiresTransition Class

The VistaHiresTransition class manages smooth animated transitions when images are loaded or when dimensions/positions change.

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.

None - all properties and map are private/static.

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 };
};
}): void

Starts an animated transition for a VistaBox instance.

Parameters:

  • vistaImage - The VistaBox instance to animate
  • onComplete - Callback when animation completes
  • shouldWait - Function returning true to pause animation
  • target - 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 },
},
});
static stop(vistaImage: VistaBox): VistaHiresTransitionOpt | undefined

Stops an active animation for a VistaBox instance.

Parameters:

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);
}
  • 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 shouldWait callback to pause during rapid navigation
GitHubnpmllms.txtContext7

© 2026 • MIT License