import type { Color } from "../../math/color.ts"; import type Tween from "../../tweens/tween.ts"; import type Renderer from "../../video/renderer.js"; import type Camera2d from "../camera2d.ts"; import CameraEffect from "./camera_effect.ts"; /** * A camera effect that fades the screen to or from a color overlay. * @category Camera * @example * // fade to black * camera.addCameraEffect(new FadeEffect(camera, { * color: "#000", * duration: 500, * direction: "in", * })); * @example * // flash white then fade back * camera.addCameraEffect(new FadeEffect(camera, { * color: "#fff", * duration: 200, * direction: "out", * })); */ export default class FadeEffect extends CameraEffect { /** * the overlay color */ color: Color; /** * the tween controlling alpha transition */ tween: Tween; /** * fade direction: "in" fades to the color, "out" fades from the color back to transparent */ direction: "in" | "out"; /** * target alpha value for completion check * @ignore */ _targetAlpha: number; /** * @param camera - the camera to apply the fade to * @param options - fade parameters * @param options.color - CSS color value or Color instance * @param [options.duration=1000] - fade duration in milliseconds * @param [options.direction="in"] - "in" fades to color, "out" fades from color to transparent * @param [options.onComplete] - callback when the fade finishes */ constructor(camera: Camera2d, options: { color: Color | string; duration?: number | undefined; direction?: "in" | "out" | undefined; onComplete?: (() => void) | undefined; }); draw(renderer: Renderer, width: number, height: number): void; update(): void; destroy(): void; } //# sourceMappingURL=fade_effect.d.ts.map