/** * FrameCapture - Capture frames from Three.js viewport for animation export * * @example * ```typescript * const capture = new FrameCapture(renderer, { width: 800, height: 600 }); * * // Capture single frame * const frame = await capture.capture(); * * // Capture all animation frames * const frames = await capture.captureAnimation(animator, (frame, total) => { * console.log(`Capturing frame ${frame}/${total}`); * }); * ``` */ import * as THREE from 'three'; import type { FrameAnimator } from './frame-animator'; import type { Geometry } from '../types'; export interface CaptureOptions { /** Output width in pixels */ width: number; /** Output height in pixels */ height: number; /** Image format */ format?: 'png' | 'jpeg'; /** Quality for JPEG (0-1) */ quality?: number; /** Background color (default: transparent for PNG, black for JPEG) */ backgroundColor?: string; } export interface CapturedFrame { /** Frame number (0-indexed) */ index: number; /** Animation time (0.0 to 1.0) */ t: number; /** Image data as Blob */ blob: Blob; /** Image data as data URL */ dataUrl: string; } export declare class FrameCapture { private renderer; private scene; private camera; private options; private offscreenRenderer; private renderTarget; constructor(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, options: CaptureOptions); /** * Initialize offscreen renderer for capturing */ private initOffscreenRenderer; /** * Capture current frame from the scene */ capture(): Promise; /** * Capture all frames from an animation * * @param code - Animation code to evaluate * @param language - 'javascript' or 'openscad' * @param fps - Frames per second * @param duration - Animation duration in milliseconds * @param updateGeometry - Callback to update scene with new geometry * @param onProgress - Progress callback */ captureAnimation(code: string, language: 'javascript' | 'openscad', fps: number, duration: number, updateGeometry: (geometry: Geometry) => void, onProgress?: (frame: number, total: number) => void): Promise; /** * Capture frames using an existing FrameAnimator */ captureFromAnimator(animator: FrameAnimator, updateGeometry: (geometry: Geometry) => void, onProgress?: (frame: number, total: number) => void): Promise; /** * Evaluate code at specific t value */ private evaluateAtT; /** * Convert data URL to Blob */ private dataUrlToBlob; /** * Update capture options */ setOptions(options: Partial): void; /** * Dispose resources */ dispose(): void; } //# sourceMappingURL=frame-capture.d.ts.map