GradientInterface
InterfaceInterface for all gradient types.
Defines the contract for gradients, which represent smooth transitions
between multiple color stops along a path (linear, radial, or conic).
Methods
public function addStop(ColorInterface $color, float $position): static
Add a color stop to the gradient.
Parameters
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface | - |
$position |
float | - |
public function interpolate(float $position): ColorInterface
Interpolate the color at a specific position in the gradient.
Parameters
| Name | Type | Default |
|---|---|---|
$position |
float | - |
public function toCss(string $colorSpace): string
Generate CSS gradient notation.
Parameters
| Name | Type | Default |
|---|---|---|
$colorSpace |
string | null |