UNPKG

@tsparticles/engine

Version:

Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.

46 lines (45 loc) 4.49 kB
import type { ICoordinates, ICoordinatesWithMode } from "../Core/Interfaces/ICoordinates.js"; import type { IDimension, IDimensionWithMode } from "../Core/Interfaces/IDimension.js"; import type { Container } from "../Core/Container.js"; import { DestroyType } from "../Enums/Types/DestroyType.js"; import type { GenericInitializer } from "../Types/EngineInitializers.js"; import type { IBounds } from "../Core/Interfaces/IBounds.js"; import type { ICircleBouncer } from "../Core/Interfaces/ICircleBouncer.js"; import type { IDelta } from "../Core/Interfaces/IDelta.js"; import type { IParticleNumericValueAnimation } from "../Core/Interfaces/IParticleValueAnimation.js"; import { OutModeDirection } from "../Enums/Directions/OutModeDirection.js"; import type { Particle } from "../Core/Particle.js"; import type { RangedAnimationValueWithRandom } from "../Options/Classes/ValueWithRandom.js"; import type { SingleOrMultiple } from "../Types/SingleOrMultiple.js"; export interface MemoizeOptions<TArgs> { keyFn?: (args: TArgs) => string; maxSize?: number; ttlMs?: number; } export declare function memoize<TArgs extends unknown[], Result>(fn: (...args: TArgs) => Result, options?: MemoizeOptions<TArgs>): (...args: TArgs) => Result; export declare function hasMatchMedia(): boolean; export declare function safeDocument(): Document; export declare function safeMatchMedia(query: string): MediaQueryList | undefined; export declare function safeIntersectionObserver(callback: (records: IntersectionObserverEntry[]) => void): IntersectionObserver | undefined; export declare function safeMutationObserver(callback: (records: MutationRecord[]) => void): MutationObserver | undefined; export declare function isInArray<T>(value: T, array: SingleOrMultiple<T>): boolean; export declare function arrayRandomIndex(array: unknown[]): number; export declare function itemFromArray<T>(array: T[], index?: number, useIndex?: boolean): T | undefined; export declare function isPointInside(point: ICoordinates, size: IDimension, offset: ICoordinates, radius?: number, direction?: OutModeDirection): boolean; export declare function areBoundsInside(bounds: IBounds, size: IDimension, offset: ICoordinates, direction?: OutModeDirection): boolean; export declare function calculateBounds(point: ICoordinates, radius: number): IBounds; export declare function deepExtend(destination: unknown, ...sources: unknown[]): unknown; export declare function circleBounceDataFromParticle(p: Particle): ICircleBouncer; export declare function circleBounce(p1: ICircleBouncer, p2: ICircleBouncer): void; export declare function executeOnSingleOrMultiple<T, U = void>(obj: SingleOrMultiple<T>, callback: (obj: T, index: number) => U): SingleOrMultiple<U>; export declare function itemFromSingleOrMultiple<T>(obj: SingleOrMultiple<T>, index?: number, useIndex?: boolean): T | undefined; export declare function findItemFromSingleOrMultiple<T>(obj: SingleOrMultiple<T>, callback: (obj: T, index: number) => boolean): T | undefined; export declare function initParticleNumericAnimationValue(options: RangedAnimationValueWithRandom, pxRatio: number): IParticleNumericValueAnimation; export declare function getPosition(position: ICoordinatesWithMode, canvasSize: IDimension): ICoordinates; export declare function getSize(size: IDimensionWithMode, canvasSize: IDimension): IDimension; export declare function updateAnimation(particle: Particle, data: IParticleNumericValueAnimation, changeDirection: boolean, destroyType: DestroyType | keyof typeof DestroyType, delta: IDelta): void; export declare function cloneStyle(style: Partial<CSSStyleDeclaration>): CSSStyleDeclaration; export declare const getFullScreenStyle: (zIndex: number) => CSSStyleDeclaration; export declare function manageListener(element: HTMLElement | Node | Window | MediaQueryList | typeof globalThis, event: string, handler: EventListenerOrEventListenerObject, add: boolean, options?: boolean | AddEventListenerOptions | EventListenerObject): void; export declare function getItemsFromInitializer<TItem, TInitializer extends GenericInitializer<TItem>>(container: Container, map: Map<Container, TItem[]>, initializers: Map<string, TInitializer>, force?: boolean): Promise<TItem[]>; export declare function getItemMapFromInitializer<TItem, TInitializer extends GenericInitializer<TItem>>(container: Container, map: Map<Container, Map<string, TItem>>, initializers: Map<string, TInitializer>, force?: boolean): Promise<Map<string, TItem>>;