LinearGradient
Linear gradient implementation.
Represents a gradient that transitions along a straight line.
The direction can be specified as an angle (in degrees) or keywords like 'to right', 'to bottom', etc.
Methods
public function addStop(ColorInterface $color, float $position): static
Parameters
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface | - |
$position |
float | - |
fromDirection
static
public static function fromDirection(string $direction): LinearGradient
Create a linear gradient with a direction keyword.
Parameters
| Name | Type | Default |
|---|---|---|
$direction |
string | - |
public function getStops(): array
public function getType(): string
public function interpolate(float $position): ColorInterface
Parameters
| Name | Type | Default |
|---|---|---|
$position |
float | - |
public function toCss(string $colorSpace): string
Parameters
| Name | Type | Default |
|---|---|---|
$colorSpace |
string | null |
public function withAngle(float $angle): LinearGradient
Return a new instance with a different angle.
Parameters
| Name | Type | Default |
|---|---|---|
$angle |
float | - |