/** * Advanced Pattern Generators * * Provides sophisticated pattern generation for creating complex GIFs including * noise patterns, fractals, geometric shapes, and mathematical spirals. */ import { RGBColor } from './types.js'; import { GifResult } from './gif-result.js'; export interface NoiseOptions { /** Noise type */ type?: 'white' | 'perlin' | 'simplex'; /** Noise scale factor */ scale?: number; /** Noise seed for reproducible results */ seed?: number; /** Color palette for noise */ colors?: RGBColor[]; } export interface FractalOptions { /** Fractal type */ type?: 'mandelbrot' | 'julia' | 'sierpinski'; /** Maximum iterations */ maxIterations?: number; /** Zoom level */ zoom?: number; /** Center point */ centerX?: number; centerY?: number; /** Color palette */ colors?: RGBColor[]; } export interface GeometricOptions { /** Shape type */ shape?: 'circles' | 'squares' | 'triangles' | 'hexagons'; /** Number of shapes */ count?: number; /** Size variation */ sizeVariation?: number; /** Color palette */ colors?: RGBColor[]; /** Background color */ backgroundColor?: RGBColor; } export interface SpiralOptions { /** Spiral type */ type?: 'archimedean' | 'logarithmic' | 'fibonacci'; /** Number of turns */ turns?: number; /** Line thickness */ thickness?: number; /** Colors for the spiral */ colors?: RGBColor[]; } /** * Generates noise pattern GIFs with various noise algorithms. * * Creates GIFs filled with different types of noise patterns including white noise, * Perlin noise, and simplex noise. Perfect for textures, backgrounds, or artistic effects. * * @param width - Image width in pixels * @param height - Image height in pixels * @param options - Noise generation options * @param options.type - Type of noise algorithm (default: 'white') * @param options.scale - Noise scale factor, higher = more detail (default: 1) * @param options.seed - Random seed for reproducible results (default: random) * @param options.colors - Color palette for noise mapping (default: black/white) * @returns A GifResult with convenient output methods * * @example * ```typescript * // White noise texture * const whiteNoise = createNoiseGif(200, 200, { * type: 'white', * colors: [ * { red: 0, green: 0, blue: 0 }, * { red: 255, green: 255, blue: 255 } * ] * }); * ``` * * @example * ```typescript * // Perlin noise with custom colors * const perlinNoise = createNoiseGif(300, 300, { * type: 'perlin', * scale: 3, * seed: 12345, * colors: [ * { red: 0, green: 50, blue: 100 }, // Dark blue * { red: 100, green: 150, blue: 200 }, // Light blue * { red: 255, green: 255, blue: 255 } // White * ] * }); * ``` * * @example * ```typescript * // Simplex noise for organic textures * const simplexNoise = createNoiseGif(400, 300, { * type: 'simplex', * scale: 2.5, * colors: [ * { red: 34, green: 139, blue: 34 }, // Forest green * { red: 107, green: 142, blue: 35 }, // Olive * { red: 154, green: 205, blue: 50 } // Yellow green * ] * }); * ``` */ export declare function createNoiseGif(width: number, height: number, options?: NoiseOptions): GifResult; /** * Generates fractal pattern GIFs using mathematical fractal algorithms. * * Creates stunning fractal visualizations including Mandelbrot sets, Julia sets, * and Sierpinski triangles. Each fractal type offers unique mathematical beauty * and infinite detail at different zoom levels. * * @param width - Image width in pixels * @param height - Image height in pixels * @param options - Fractal generation options * @param options.type - Fractal algorithm type (default: 'mandelbrot') * @param options.maxIterations - Maximum iterations for convergence (default: 100) * @param options.zoom - Zoom level into fractal (default: 1) * @param options.centerX - X coordinate of fractal center (default: 0) * @param options.centerY - Y coordinate of fractal center (default: 0) * @param options.colors - Color palette for fractal visualization (default: rainbow) * @returns A GifResult with convenient output methods * * @example * ```typescript * // Classic Mandelbrot set * const mandelbrot = createFractalGif(400, 400, { * type: 'mandelbrot', * maxIterations: 150, * zoom: 1, * centerX: -0.5, * centerY: 0 * }); * ``` * * @example * ```typescript * // Julia set with custom parameters * const julia = createFractalGif(300, 300, { * type: 'julia', * maxIterations: 200, * zoom: 1.5, * colors: [ * { red: 0, green: 0, blue: 0 }, * { red: 255, green: 0, blue: 100 }, * { red: 255, green: 100, blue: 0 }, * { red: 255, green: 255, blue: 0 } * ] * }); * ``` * * @example * ```typescript * // Sierpinski triangle * const sierpinski = createFractalGif(350, 350, { * type: 'sierpinski', * maxIterations: 100 * }); * ``` */ export declare function createFractalGif(width: number, height: number, options?: FractalOptions): GifResult; /** * Generates geometric pattern GIFs with randomized shape placement. * * Creates patterns filled with geometric shapes (circles, squares, triangles, hexagons) * with randomized positions, sizes, and colors. Perfect for backgrounds, textures, * or decorative elements. * * @param width - Image width in pixels * @param height - Image height in pixels * @param options - Geometric pattern options * @param options.shape - Type of shape to generate (default: 'circles') * @param options.count - Number of shapes to place (default: 20) * @param options.sizeVariation - Size variation factor 0-1 (default: 0.5) * @param options.colors - Color palette for shapes (default: red/green/blue) * @param options.backgroundColor - Background color (default: white) * @returns A GifResult with convenient output methods * * @example * ```typescript * // Random colorful circles * const circles = createGeometricGif(300, 200, { * shape: 'circles', * count: 30, * sizeVariation: 0.8, * colors: [ * { red: 255, green: 100, blue: 100 }, * { red: 100, green: 255, blue: 100 }, * { red: 100, green: 100, blue: 255 } * ] * }); * ``` * * @example * ```typescript * // Uniform triangles on dark background * const triangles = createGeometricGif(400, 300, { * shape: 'triangles', * count: 15, * sizeVariation: 0.2, * backgroundColor: { red: 20, green: 20, blue: 30 }, * colors: [ * { red: 255, green: 215, blue: 0 }, // Gold * { red: 255, green: 140, blue: 0 } // Orange * ] * }); * ``` * * @example * ```typescript * // Hexagon pattern * const hexagons = createGeometricGif(250, 250, { * shape: 'hexagons', * count: 25, * sizeVariation: 0.6 * }); * ``` */ export declare function createGeometricGif(width: number, height: number, options?: GeometricOptions): GifResult; /** * Generates mathematical spiral pattern GIFs. * * Creates beautiful spiral patterns using different mathematical spiral equations * including Archimedean, logarithmic, and Fibonacci spirals. Each type produces * unique aesthetic patterns suitable for art, backgrounds, or mathematical visualization. * * @param width - Image width in pixels * @param height - Image height in pixels * @param options - Spiral generation options * @param options.type - Type of spiral equation (default: 'archimedean') * @param options.turns - Number of spiral turns/rotations (default: 5) * @param options.thickness - Line thickness in pixels (default: 2) * @param options.colors - Color palette for gradient along spiral (default: red/green) * @returns A GifResult with convenient output methods * * @example * ```typescript * // Archimedean spiral (uniform spacing) * const archimedean = createSpiralGif(300, 300, { * type: 'archimedean', * turns: 8, * thickness: 3, * colors: [ * { red: 255, green: 0, blue: 0 }, * { red: 255, green: 255, blue: 0 }, * { red: 0, green: 255, blue: 0 } * ] * }); * ``` * * @example * ```typescript * // Logarithmic spiral (exponential growth) * const logarithmic = createSpiralGif(400, 400, { * type: 'logarithmic', * turns: 4, * thickness: 4, * colors: [ * { red: 0, green: 0, blue: 255 }, * { red: 128, green: 0, blue: 128 } * ] * }); * ``` * * @example * ```typescript * // Fibonacci spiral (golden ratio) * const fibonacci = createSpiralGif(350, 350, { * type: 'fibonacci', * turns: 6, * thickness: 2 * }); * ``` */ export declare function createSpiralGif(width: number, height: number, options?: SpiralOptions): GifResult;