This API is experimental
Its behavior may change in a future version of p5.js.
Get the shader used when drawing the strokes of shapes.
You can call baseStrokeShader().modify()
and change any of the following hooks:
Hook | Description |
---|---|
| Called at the start of the vertex shader. |
| Update the position of vertices before transforms are applied. It takes in |
| Update the position of vertices after transforms are applied. It takes in |
| Update the stroke weight. It takes in |
| Update the center of the line. It takes in |
| Update the position of each vertex on the edge of the line. It takes in |
| Update the color of each vertex. It takes in a |
| Called at the end of the vertex shader. |
| Called at the start of the fragment shader. |
| Update the inputs to the shader. It takes in a struct
|
| Caps and joins are made by discarded pixels in the fragment shader to carve away unwanted areas. Use this to change this logic. It takes in a |
| Update the final color after mixing. It takes in a |
| Called at the end of the fragment shader. |
Most of the time, you will need to write your hooks in GLSL ES version 300. If you are using WebGL 1 instead of 2, write your hooks in GLSL ES 100 instead.
Call baseStrokeShader().inspectHooks()
to see all the possible hooks and their default implementations.
उदाहरण
Returns
संबंधित संदर्भ
inspectHooks
Logs the hooks available in this shader, and their current implementation.
modify
Returns a new shader, based on the original, but with custom snippets of shader code replacing default behaviour.
baseColorShader
Get the shader used when no lights or materials are applied.
baseMaterialShader
Get the default shader used with lights, materials, and textures.