Skip to content

RadialGradient

Overview

A radial gradient that can be passed into the 'fill' or 'stroke' parameters.

SVG gradients, see http://www.w3.org/TR/SVG/pservers.html

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

Class RadialGradient

import { RadialGradient } from 'scenerystack/scenery';

Constructor

new RadialGradient( x0 : number, y0 : number, r0 : number, x1 : number, y1 : number, r1 : number )

Instance Methods

createCanvasGradient() : CanvasGradient

Returns a fresh gradient given the starting parameters

createSVGPaint( svgBlock : SVGBlock ) : SVGRadialGradient

Creates an SVG paint object for creating/updating the SVG equivalent definition.

getSVGStops() : GradientStop[]

Returns stops suitable for direct SVG use.

NOTE: SVG has certain stop requirements, so we need to remap/reverse in some cases.

toString() : string

Returns a string form of this object

Instance Properties

start : Vector2

end : Vector2

endRadius : number

largePoint : Vector2

maxRadius : number

isRadialGradient : boolean

Source Code

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