Gradient engine
Name: gradient. Output: SVG. Fills a shape with a gradient whose colors are
derived from the seed.
Avatar::engine('gradient')
->seed('user@example.com')
->size(256)
->shape('circle')
->gradientType('diagonal')
->colorStops(3)
->generate();
Options
| Option | Method | Type | Default |
|---|---|---|---|
| Shape | shape() | string | circle |
| Gradient type | gradientType() | string | horizontal |
| Color stops | colorStops() | int | 3 |
shape accepts circle, square, or hexagon.
Gradient types
| Value | Result |
|---|---|
horizontal | Left-to-right linear gradient (default). |
vertical | Top-to-bottom linear gradient. |
diagonal | Corner-to-corner linear gradient. |
radial | Radial gradient from the center. |
wavy | Linear gradient with interleaved mid-stops. |
marble | Layered, blurred "marble" composition. |
The number of color stops is set by colorStops. Colors fan out from the seed's
base hue across the requested number of stops.
Marble variant
When gradientType is marble, the engine renders two overlapping blurred
shapes inside a masked frame. Two additional options are read from the option bag
for this mode:
- A
rotationvalue affects the hexagon mask shape. - A
marbleBlurinteger controls the Gaussian blur amount (default7).
The mask corners follow the shape option (circle, square, or hexagon).