Class RadialGradient
Hierarchy
- BaseGradient
- RadialGradient
Index
Constructors
constructor
Creates a new radial gradient
Parameters
Optional x0: number
x coordinate of the first circle's center
Optional y0: number
y coordinate of the first circle's center
Optional r0: number
radius of the first circle
Optional x1: number
x coordinate of the second circle's center
Optional y1: number
y coordinate of the second circle's center
Optional r1: number
radius of the second circle
Returns RadialGradient
Accessors
color Stops
Color stops of the gradient
Returns GradientColorStop[]
r0
radius of the first circle
Returns number
r1
radius of the second circle
Returns number
x0
x coordinate of the first circle's center
Returns number
x1
x coordinate of the second circle's center
Returns number
y0
y coordinate of the first circle's center
Returns number
y1
y coordinate of the second circle's center
Returns number
Methods
add Color StopSearch playground for addColorStop
Adds a new color stop to the gradient.
Parameters
offset: number
the offset of the stop on the gradient. Should be between 0 and 1
color: string
the color of the stop
Returns void
clear Color StopsSearch playground for clearColorStops
Removes all color stops from the gradient
Returns void
get Canvas GradientSearch playground for getCanvasGradient
If there are any changes or the context changed, regenerate the canvas gradient object. Else, reuse the existing gradient.
Parameters
context: ICanvasRenderingContext
Returns CanvasGradient
get Class NameSearch playground for getClassName
Class name of the gradient
Returns string
the class name of the gradient
parseSearch playground for parse
Parses a gradient from a serialization object
Parameters
serializationObject: any
the object to parse from
Returns void
remove Color StopSearch playground for removeColorStop
Removes an existing color stop with the specified offset from the gradient
Parameters
offset: number
the offset of the stop to be removed
Returns void
serializeSearch playground for serialize
Serializes this gradient
Parameters
serializationObject: any
the object to serialize to
Returns void
Gradient formed from two circles with their own centers and radius. The coordinates of the circles centers are relative to the canvas' space, not to any control's space.
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createRadialGradient