Image & Canvas
canvasDrawGradient
$canvasDrawGradient[]
$canvasDrawGradient fills a rectangle of the current canvas with a smooth gradient. It returns an empty string.
Syntax
bdfd
$canvasDrawGradient[x;y;width;height;colors;(angle);(blend);(container)]
Canvas functions work on the current canvas, the last one made with $canvasCreate; they have no canvas-name argument. Called before any $canvasCreate they have no effect.
Parameters
| Parameter | Description |
|---|---|
x, y |
Required. Position of the top-left corner of the rectangle. |
width, height |
Required. Size of the rectangle in pixels. |
colors |
Required. Two to four colors separated by commas, for example #5865F2,#EB459E. Same color formats as $canvasDrawRect. The stops are spread evenly. |
angle |
Optional. Direction in degrees: 0 (default) goes from left to right, 90 from top to bottom. |
blend |
Optional. Blend mode, like $canvasDrawRect. |
container |
Optional. Name of a container defined earlier with $canvasContainer. |
Examples
A banner with a diagonal gradient
$canvasCreate[banner;600;200;#202225]
$canvasDrawGradient[0;0;600;200;#5865F2,#EB459E;45]
$canvasDrawText[Welcome!;30;80;48;#FFFFFF;;;;geist-bold]
$attachImage[banner]
$sendMessage[Here is your banner.]
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.