pixi.js
    Preparing search index...

    Interface ConvertedStrokeStyleAdvanced

    used internally and is a complete stroke style

    interface ConvertedStrokeStyle {
        alignment: number;
        alpha: number;
        cap: LineCap;
        color: number;
        fill: FillGradient | FillPattern;
        join: LineJoin;
        matrix: Matrix;
        miterLimit: number;
        pixelLine: boolean;
        texture: Texture<TextureSource<any>>;
        textureSpace: TextureSpace;
        width: number;
    }
    Index

    Properties

    alignment: number

    The alignment of the stroke relative to the path.

    • 1: Inside the shape
    • 0.5: Centered on the path (default)
    • 0: Outside the shape
    // Inside alignment
    const stroke = { alignment: 1 };
    // Centered alignment
    const stroke = { alignment: 0.5 };
    // Outside alignment
    const stroke = { alignment: 0 };
    0.5
    
    alpha: number

    The alpha value to use for the fill. This value should be between 0 (fully transparent) and 1 (fully opaque).

    const fillStyle = { alpha: 0.5 }; // 50% opacity
    
    1
    
    cap: LineCap

    The style to use for the ends of open paths.

    • 'butt': Ends at path end
    • 'round': Rounds past path end
    • 'square': Squares past path end
    const stroke = { cap: 'round' };
    
    'butt'
    

    LineCap For line cap options

    color: number

    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
    };
    join: LineJoin

    The style to use where paths connect.

    • 'miter': Sharp corner
    • 'round': Rounded corner
    • 'bevel': Beveled corner
    const stroke = { join: 'round' };
    
    'miter'
    

    LineJoin For line join options

    matrix: Matrix

    The transformation matrix to apply to the fill pattern or texture. Used to scale, rotate, translate, or skew the fill.

    // Scale and rotate a texture fill
    const fillStyle = {
    texture: Texture.from('myImage.png'),
    matrix: new Matrix()
    .scale(0.5, 0.5)
    .rotate(Math.PI / 4)
    };
    null
    
    miterLimit: number

    Controls how far miter joins can extend. Only applies when join is 'miter'. Higher values allow sharper corners.

    const stroke = {
    join: 'miter',
    miterLimit: 3,
    };
    10
    
    pixelLine: boolean

    When true, ensures crisp 1px lines by aligning to pixel boundaries.

    Note

    Only available for Graphics fills.

    const graphics = new Graphics();

    // Draw pixel-perfect line
    graphics
    .moveTo(50, 50)
    .lineTo(150, 50)
    .stroke({
    width: 1,
    pixelLine: true,
    color: 0x000000
    });
    false
    
    texture: Texture<TextureSource<any>>

    The texture to use for the fill.

    const fillStyle = { texture: Texture.from('myImage.png') };
    

    Texture For more details on textures

    textureSpace: TextureSpace

    Determines how texture coordinates are calculated across shapes.

    • 'local': Texture coordinates are relative to each shape's bounds
    • 'global': Texture coordinates are in world space
    // 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'
    };
    'local'
    

    TextureSpace For more details on texture spaces

    width: number

    The width of the stroke in pixels.

    const stroke = { width: 4 };
    
    1