|
5 | 5 | * |
6 | 6 | * @param {number} opacity - specifies gradient opacity. When set to 0, gradient is not applied. Value range: `0` - `1`. |
7 | 7 | * @param {string} [color="000"] - (optional) specifies gradient color. If omitted, the gradient is black. Default `"000"`. |
8 | | - * @param {"down" | "up" | "right" | "left"} [direction="down"] - (optional) specifies gradient direction. Default `"down"`. |
| 8 | + * @param {"down" | "up" | "right" | "left" | number} [direction="down"] - (optional) specifies gradient direction. Default `"down"`. |
9 | 9 | * |
10 | 10 | * Available values: |
11 | 11 | * - `down` - the top side of the gradient is transparrent, the bottom side is opaque |
12 | 12 | * - `up` - the bottom side of the gradient is transparrent, the top side is opaque |
13 | 13 | * - `right` - the left side of the gradient is transparrent, the right side is opaque |
14 | 14 | * - `left` - the right side of the gradient is transparrent, the left side is opaque |
| 15 | + * - `number` - angle in degrees (clockwise). `0` creates a gradient from top to bottom; `90` creates a gradient from right to left. |
15 | 16 | * @param {number} [start=0.0] - (optional) specifies the start point of the gradient. Value range: `0.0` - `1.0`. Default `0.0`. |
16 | 17 | * @param {number} [stop=1.0] - (optional) specifies the end point of the gradient. Value range: `0.0` - `1.0`. Default `1.0`. |
17 | 18 | * |
|
25 | 26 | * // Apply a gray gradient with 0.3 opacity from the left to the right of the image with the start point at 0.2 and the end point at 0.8 |
26 | 27 | * {gradient: {opacity: 0.3, direction: "right", color: "808080", start: 0.2, stop: 0.8}} |
27 | 28 | * |
| 29 | + * // Apply a gray gradient with 0.3 opacity at a 45 degree angle |
| 30 | + * {gradient: {opacity: 0.3, direction: 45, color: "808080"}} |
| 31 | + * |
28 | 32 | * @see https://docs.imgproxy.net/generating_the_url?id=gradient |
29 | 33 | */ |
30 | 34 | interface Gradient { |
31 | 35 | opacity: number; |
32 | 36 | color?: string; |
33 | | - direction?: "down" | "up" | "right" | "left"; |
| 37 | + direction?: "down" | "up" | "right" | "left" | number; |
34 | 38 | start?: number; |
35 | 39 | stop?: number; |
36 | 40 | } |
|
0 commit comments