# Class: DashLineShader

A shader that draws the strokes of a [SmoothGraphics](scene.SmoothGraphics.html.md) as dashed lines, with anti-aliased dash ends.

Set it as the `customShader` of the context: it applies to every stroke of the context,
and the context is then rendered without batching. Dashes follow the path, and
restart at the beginning of each shape. Fills are hidden.

## Example

```ts
import { DashLineShader, SmoothGraphics } from 'pixi.js';

const dashes = new DashLineShader({ dash: 10, gap: 5 });
const graphics = new SmoothGraphics();

graphics.context.customShader = dashes;
graphics.moveTo(0, 0).lineTo(200, 100).stroke({ color: 0xff0000, width: 3 });

// the dash pattern can be changed at any time
dashes.dash = 20;
```

## Extends

- [`Shader`](rendering.Shader.html.md)

## Constructors

### Constructor

> **new DashLineShader**(`options?`): `DashLineShader`

#### Parameters

##### options?

[`DashLineShaderOptions`](scene.DashLineShaderOptions.html.md)

Dash and gap lengths

#### Returns

`DashLineShader`

#### Overrides

[`Shader`](rendering.Shader.html.md).[`constructor`](rendering.Shader.html#constructor)

## Properties

### compatibleRenderers

> `readonly` **compatibleRenderers**: `number`

A number that uses two bits on whether the shader is compatible with the WebGL renderer and/or the WebGPU renderer.
0b00 - not compatible with either
0b01 - compatible with WebGL
0b10 - compatible with WebGPU
This is automatically set based on if a [GlProgram](rendering.GlProgram.html.md) or [GpuProgram](rendering.GpuProgram.html.md) is provided.

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`compatibleRenderers`](rendering.Shader.html#compatiblerenderers)

***

### glProgram

> **glProgram**: [`GlProgram`](rendering.GlProgram.html.md)

An instance of the GL program used by the WebGL renderer

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`glProgram`](rendering.Shader.html#glprogram)

***

### gpuProgram

> **gpuProgram**: [`GpuProgram`](rendering.GpuProgram.html.md)

An instance of the GPU program used by the WebGPU renderer

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`gpuProgram`](rendering.Shader.html#gpuprogram)

***

### groups

> **groups**: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`number`, [`BindGroup`](rendering.BindGroup.html.md)\>

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`groups`](rendering.Shader.html#groups)

***

### resources

> **resources**: [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>

A record of the resources used by the shader.

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`resources`](rendering.Shader.html#resources)

***

### uid

> `readonly` **uid**: `number`

A unique identifier for the shader

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`uid`](rendering.Shader.html#uid)

## Accessors

### dash

#### Get Signature

> **get** **dash**(): `number`

Length of each dash, in pixels at a scale of 1. Set it to 0 to hide the strokes.

##### Default

```ts
8
```

##### Returns

`number`

#### Set Signature

> **set** **dash**(`value`): `void`

##### Parameters

###### value

`number`

##### Returns

`void`

***

### gap

#### Get Signature

> **get** **gap**(): `number`

Length of each gap between dashes, in pixels at a scale of 1.

##### Default

```ts
5
```

##### Returns

`number`

#### Set Signature

> **set** **gap**(`value`): `void`

##### Parameters

###### value

`number`

##### Returns

`void`

## Methods

### addResource()

> **addResource**(`name`, `groupIndex`, `bindIndex`): `void`

Sometimes a resource group will be provided later (for example global uniforms)
In such cases, this method can be used to let the shader know about the group.

#### Parameters

##### name

`string`

the name of the resource group

##### groupIndex

`number`

the index of the group (should match the webGPU shader group location)

##### bindIndex

`number`

the index of the bind point (should match the webGPU shader bind point)

#### Returns

`void`

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`addResource`](rendering.Shader.html#addresource)

***

### destroy()

> **destroy**(`destroyPrograms`): `void`

Use to destroy the shader when its not longer needed.
It will destroy the resources and remove listeners.

#### Parameters

##### destroyPrograms

`boolean` = `false`

if the programs should be destroyed as well.
Make sure its not being used by other shaders!

#### Returns

`void`

#### Inherited from

[`Shader`](rendering.Shader.html.md).[`destroy`](rendering.Shader.html#destroy)

***

### from()

#### Call Signature

> `static` **from**(`options`): [`Shader`](rendering.Shader.html.md)

A short hand function to create a shader based of a vertex and fragment shader.

##### Parameters

###### options

[`ShaderFromGroups`](rendering.ShaderFromGroups.html.md)

##### Returns

[`Shader`](rendering.Shader.html.md)

A shiny new PixiJS shader!

##### Inherited from

[`Shader`](rendering.Shader.html.md).[`from`](rendering.Shader.html#from)

#### Call Signature

> `static` **from**(`options`): [`Shader`](rendering.Shader.html.md)

A short hand function to create a shader based of a vertex and fragment shader.

##### Parameters

###### options

[`ShaderFromResources`](rendering.ShaderFromResources.html.md)

##### Returns

[`Shader`](rendering.Shader.html.md)

A shiny new PixiJS shader!

##### Inherited from

[`Shader`](rendering.Shader.html.md).[`from`](rendering.Shader.html#from)
