pixi.js
    Preparing search index...

    Class FillPattern

    A class that represents a fill pattern for use in Text and Graphics fills. It allows for textures to be used as patterns, with optional repetition modes.

    Patterns default to textureSpace: 'global', meaning tiles repeat continuously across world space and adjacent shapes share the same tiling grid. Pass textureSpace: 'local' to map a single tile to each shape's bounds instead.

    const txt = await Assets.load('https://pixijs.com/assets/bg_scene_rotate.jpg');

    // global tiling (default) — pattern continues across shapes
    const pat = new FillPattern({ texture: txt, repetition: 'repeat' });

    // legacy positional form is still supported
    const pat2 = new FillPattern(txt, 'repeat');

    const textPattern = new Text({
    text: 'PixiJS',
    style: {
    fontSize: 36,
    fill: 0xffffff,
    stroke: { fill: pat, width: 10 },
    },
    });

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    textureSpace: TextureSpace

    Whether pattern coordinates are evaluated in local or global space.

    'global'
    
    transform: Matrix = ...

    The transform matrix applied to the pattern

    Accessors

    • get styleKey(): string

      Returns a unique key for this instance. This key is used for caching.

      Returns string

      Unique key for the instance

    Methods

    • Destroys the fill pattern, releasing resources. This will also destroy the internal texture.

      Returns void

    • Sets the transform for the pattern

      Parameters

      • Optionaltransform: Matrix

        The transform matrix to apply to the pattern. If not provided, the pattern will use the default transform.

      Returns void