LinearGradientFill
in package
implements
FillInterface
FinalYes
Linear gradient background fill.
Tags
Table of Contents
Interfaces
- FillInterface
- Interface for all fill types.
Properties
- $angle : float|null
- The gradient angle in degrees.
- $colorStops : array<int, ColorStop>
- The color stops.
Methods
- addColorStop() : $this
- Add a color stop.
- addStop() : $this
- Add a color stop at a location.
- diagonal() : self
- Create a diagonal gradient (top-left to bottom-right).
- getType() : string
- Get the fill type identifier.
- horizontal() : self
- Create a horizontal gradient (left to right).
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- setAngle() : $this
- Set the gradient angle.
- vertical() : self
- Create a vertical gradient (top to bottom).
Properties
$angle
The gradient angle in degrees.
private
float|null
$angle
= null
$colorStops
The color stops.
private
array<int, ColorStop>
$colorStops
= []
Methods
addColorStop()
Add a color stop.
public
addColorStop(ColorStop $stop) : $this
Parameters
- $stop : ColorStop
-
The color stop.
Return values
$thisaddStop()
Add a color stop at a location.
public
addStop(string $color, float $location) : $this
Parameters
- $color : string
-
The color.
- $location : float
-
The location (0-100).
Return values
$thisdiagonal()
Create a diagonal gradient (top-left to bottom-right).
public
static diagonal(string $startColor, string $endColor) : self
Parameters
- $startColor : string
-
The start color.
- $endColor : string
-
The end color.
Return values
self —A new instance.
getType()
Get the fill type identifier.
public
getType() : string
Return values
string —The fill type.
horizontal()
Create a horizontal gradient (left to right).
public
static horizontal(string $startColor, string $endColor) : self
Parameters
- $startColor : string
-
The start color.
- $endColor : string
-
The end color.
Return values
self —A new instance.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setAngle()
Set the gradient angle.
public
setAngle(float $angle) : $this
Parameters
- $angle : float
-
The angle in degrees.
Return values
$thisvertical()
Create a vertical gradient (top to bottom).
public
static vertical(string $startColor, string $endColor) : self
Parameters
- $startColor : string
-
The start color.
- $endColor : string
-
The end color.
Return values
self —A new instance.