GradientFactory
class GradientFactory
Factory class for generating color-gradient textures.
Constructor
new GradientFactory() → {}
Factory class for generating color-gradient textures.
Summary
Methods from GradientFactory
PIXI.RenderTexture |
|
PIXI.RenderTexture |
|
Public Methods
static createLinearGradient(renderer: PIXI.Renderer, renderTexture: PIXI.RenderTexture, options: { x0 : number, y0 : number, x1 : number, y1 : number, colorStops : ColorStop[] }) → {PIXI.RenderTexture}
Renders a linear-gradient into renderTexture
that starts from (x0, y0) and ends at (x1, y1). These
coordinates are defined in the texture's space. That means only the frame (0, 0, renderTexture.width
, renderTexture.height
)
will be rendered.
This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation causes a batch renderer flush.
Name | Type | Description |
---|---|---|
renderer | PIXI.Renderer |
The renderer to use for drawing the gradient. |
renderTexture | PIXI.RenderTexture |
The texture to render the gradient into. |
options | { x0 : number, y0 : number, x1 : number, y1 : number, colorStops : ColorStop[] } |
The gradient parameters. |
options.x0 |
The x-coordinate of the gradient's start point. |
|
options.y0 |
The y-coordinate of the gradient's start point. |
|
options.x1 |
The x-coordinate of the gradient's end point. |
|
options.y1 |
The y-coordinate of the gradient's end point. |
|
options.colorStops |
The color stops along the gradient pattern. |
Type | Description |
---|---|
PIXI.RenderTexture |
static createRadialGradient(renderer: PIXI.Renderer, renderTexture: PIXI.RenderTexture, options: { x0 : number, y0 : number, r0 : number, x1 : number, y1 : number, r1 : number, colorStops : ColorStop[] }) → {PIXI.RenderTexture}
Renders a radial-gradient into renderTexture
that starts at the circle centered at (x0, y0) of radius r0 and
ends at the circle centered at (x1, y1) of radius r1.
This method can be called inside a render cycle, and will preserve the renderer state. However, the current implementation causes a batch renderer flush.
Name | Type | Description |
---|---|---|
renderer | PIXI.Renderer |
The renderer to use for drawing the gradient. |
renderTexture | PIXI.RenderTexture |
The texture to render the gradient into. |
options | { x0 : number, y0 : number, r0 : number, x1 : number, y1 : number, r1 : number, colorStops : ColorStop[] } |
The gradient parameters. |
options.x0 |
The x-coordinate of the starting circle's center. |
|
options.y0 |
The y-coordinate of the starting circle's center. |
|
options.r0 |
The radius of the starting circle. |
|
options.x1 |
The x-coordinate of the ending circle's center. |
|
options.y1 |
The y-coordinate of the ending circle's center. |
|
options.colorStops |
The color stops along the gradient pattern. |
Type | Description |
---|---|
PIXI.RenderTexture |