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
NameTypeDefault
$color ColorInterface -
$position float -

fromDirection

static
public static function fromDirection(string $direction): LinearGradient

Create a linear gradient with a direction keyword.

Parameters
NameTypeDefault
$direction string -
public function getAngle(): float

Get the direction angle in degrees.

public function getStops(): array
public function getType(): string
public function interpolate(float $position): ColorInterface
Parameters
NameTypeDefault
$position float -
public function toCss(string $colorSpace): string
Parameters
NameTypeDefault
$colorSpace string null
public function withAngle(float $angle): LinearGradient

Return a new instance with a different angle.

Parameters
NameTypeDefault
$angle float -