Skip to content

SVGGradient

Overview

Base type for controllers that create and keep an SVG gradient element up-to-date with a Scenery gradient.

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

Class SVGGradient

import { SVGGradient } from 'scenerystack/scenery';

Constructor

new SVGGradient( svgBlock : SVGBlock, gradient : Gradient )

Instance Methods

isActiveSVGGradient() : this is ActiveSVGGradient

initialize( svgBlock : SVGBlock, gradient : Gradient )

createDefinition() : SVGGradientElement

(protected)

Creates the gradient-type-specific definition.

markDirty()

Called from SVGGradientStop when a stop needs to change the actual color.

update()

Called from SVGBlock when we need to update our color stops.

dispose()

Disposes, so that it can be reused from the pool.

freeToPool()

Instance Properties

gradient : Gradient | null

stops : SVGGradientStop[]

definition : SVGGradientElement

persistent

Type ActiveSVGGradient

import type { ActiveSVGGradient } from 'scenerystack/scenery';

WithoutNull<SVGGradient, "svgBlock" | "gradient">

Source Code

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