UNPKG

@itwin/frontend-devtools

Version:

Debug menu and supporting UI widgets

77 lines 3.46 kB
/** @packageDocumentation * @module Effects */ import { Range1d, Range2d, Vector2d } from "@itwin/core-geometry"; import { DecorateContext, Decorator, ParticleProps, Tool, Viewport } from "@itwin/core-frontend"; /** Represents one particle displayed by a [[SnowDecorator]]. * Particle positions are in [CoordSystem.View]($frontend). * @beta */ export interface SnowParticle extends ParticleProps { /** Make x, y, and z from ParticleProps writable. */ x: number; y: number; z: number; /** Current velocity, in pixels per second. */ velocity: Vector2d; } /** Parameters controlling how a [[SnowDecorator]] works. * @beta */ export interface SnowParams { /** The number of snow particles to produce. This could alternatively be expressed as a density so that small viewports would not be more crowded than larger ones. */ numParticles: number; /** Range from which to randomly select each particle's size, in pixels. */ sizeRange: Range1d; /** Range from which to randomly select each particle's transparency. */ transparencyRange: Range1d; /** Range from which to randomly select each particle's initial velocity, in pixels per second. */ velocityRange: Range2d; /** Range from which to randomly select an acceleration to apply to each particle's velocity each frame, in pixels per second squared, to simulate wind. */ accelerationRange: Range2d; /** Wind velocity in pixels per second in X. */ windVelocity: number; } /** Simulates snowfall in a [Viewport]($frontend) using particle effects. * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator. * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects. * @beta */ export declare class SnowDecorator implements Decorator { /** The viewport being decorated. */ readonly viewport: Viewport; /** Invoked when this decorator is to be destroyed. */ readonly [Symbol.dispose]: VoidFunction; /** The initial width and height of the viewport, from which we randomly select each particle's initial position. */ private readonly _dimensions; /** The list of particles being drawn. */ private readonly _particles; /** The image to display for each particle. */ private _texture?; /** The last time `updateParticles()` was invoked, in milliseconds. */ private _lastUpdateTime; private readonly _params; private constructor(); decorate(context: DecorateContext): void; /** Change some of the parameters affecting this decorator. */ configure(params: Partial<SnowParams>): void; /** Emit a new particle with randomized properties. */ private emit; private updateParticles; private static readonly _decorators; /** Toggle this decorator for the specified viewport. * @param viewport The viewport to which the effect should be applied or removed. * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state. */ static toggle(viewport: Viewport, enable?: boolean): Promise<void>; } /** Toggles a decorator that simulates snow using particle effects. * @see [[SnowDecorator]] for the implementation of the decorator. * @beta */ export declare class SnowEffect extends Tool { static toolId: string; run(enable?: boolean): Promise<boolean>; parseAndRun(...args: string[]): Promise<boolean>; } //# sourceMappingURL=Snow.d.ts.map