Advanced
The alpha value to use for the fill. This value should be between 0 (fully transparent) and 1 (fully opaque).
The fill pattern or gradient to use. This can be either a FillPattern for repeating textures or a FillGradient for color transitions.
// Using a gradient
const gradient = new FillGradient({
end: { x: 1, y: 0 },
stops: [
{ color: 0xff0000, offset: 0 }, // Red at start
{ color: 0x0000ff, offset: 1 }, // Blue at end
]
});
const fillStyle = {
fill: gradient,
alpha: 0.8
};
// Using a pattern
const pattern = new FillPattern(
Texture.from('pattern.png'),
'repeat' // or 'no-repeat', 'repeat-x', 'repeat-y'
);
const fillStyle = {
fill: pattern
};
The transformation matrix to apply to the fill pattern or texture. Used to scale, rotate, translate, or skew the fill.
The texture to use for the fill.
Texture For more details on textures
Determines how texture coordinates are calculated across shapes.
// Local space - texture fits each shape independently
const fillStyle = {
texture: Texture.from('myImage.png'),
textureSpace: 'local'
};
// Global space - texture continues across shapes
const fillStyle = {
texture: Texture.from('myImage.png'),
textureSpace: 'global'
};
TextureSpace For more details on texture spaces
used internally and is a complete fill style