Skip to content

GaussianBlur

Overview

GaussianBlur filter

EXPERIMENTAL! DO not use in production code yet

TODO: preventFit OR handle bounds increase (or both) https://github.com/phetsims/scenery/issues/1581

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class GaussianBlur

import { GaussianBlur } from 'scenerystack/scenery';

Constructor

new GaussianBlur( standardDeviation : number, filterRegionPercentage )

Instance Methods

getCSSFilterString() : string

Returns the CSS-style filter substring specific to this single filter, e.g. grayscale(1). This should be used for both DOM elements (https://developer.mozilla.org/en-US/docs/Web/CSS/filter) and when supported, Canvas (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter).

applySVGFilter( svgFilter : SVGFilterElement, inName : string, resultName? : string )

Appends filter sub-elements into the SVG filter element provided. Should include an in=${inName} for all inputs, and should either output using the resultName (or if not provided, the last element appended should be the output). This effectively mutates the provided filter object, and will be successively called on all Filters to build an SVG filter object.

isDOMCompatible() : boolean

isSVGCompatible() : boolean

applyCanvasFilter( wrapper : CanvasContextWrapper )

Source Code

See the source for GaussianBlur.ts in the scenery repository.