Features
- Multiple dot styles (classic, gooey, holes, soft)
- Two grid types (square, hex)
- Original color preservation or custom colors
- Adjustable dot size and contrast
- Grain effects and overlays
- Inverted luminance option
Basic Usage
Parameters
Visual Parameters
string | HTMLImageElement
default:"''"
Optional source image to apply the halftone effect to
'classic' | 'gooey' | 'holes' | 'soft'
default:"'gooey'"
Dot style:
classic: Sharp circular dotsgooey: Soft blended dots that merge togetherholes: Inverted dots creating holessoft: Smooth gradient dots
'square' | 'hex'
default:"'hex'"
Grid arrangement:
square: Square/rectangular gridhex: Hexagonal grid (more organic)
number
default:"0.5"
Grid size relative to the image box (0 = large dots, 1 = small dots)
number
default:"1.25"
Maximum dot size relative to grid cell
number
default:"0.4"
Contrast applied to the sampled image before halftoning
string
default:"'#2b2b2b'"
Foreground/dot color in hex, rgb, or rgba format
string
default:"'#f2f1e8'"
Background color in hex, rgb, or rgba format
boolean
default:"false"
Use sampled image’s original colors instead of colorFront
boolean
default:"false"
Inverts the image luminance (doesn’t affect the color scheme)
number
default:"0.2"
Strength of grain distortion applied to dot edges
number
default:"0.2"
Post-processing black/white grain overlay
number
default:"0.5"
Scale applied to both grain distortion and grain overlay
Sizing Parameters
'none' | 'contain' | 'cover'
default:"'cover'"
How to fit the shader into the canvas dimensions
number
default:"1"
Overall zoom level of the graphics
number
default:"0"
Overall rotation angle in degrees
number
default:"0"
Horizontal offset of the graphics center
number
default:"0"
Vertical offset of the graphics center
Animation Parameters
number
default:"0"
Animation speed multiplier (0 for static)
number
default:"0"
Manual frame control for animation
Presets
The HalftoneDots shader comes with several built-in presets:- Default: Gooey dots on hex grid with grain
- LED Screen: Soft dots on square grid simulating LED display
- Mosaic: Classic dots with original colors
- Round and Square: Hole dots with inverted luminance
Examples
LED Screen Effect
Mosaic Pattern
Inverted Holes
Classic Print
Technical Details
Shader Uniforms (Vanilla JS)
When using the vanilla JavaScript API:Dot Types
classic(0): Sharp circular dots with antialiasinggooey(1): Soft dots that blend togetherholes(2): Inverted effect creating holessoft(3): Smooth gradient dots
Grid Types
square(0): Rectangular grid alignmenthex(1): Hexagonal grid (offset rows)
Color Modes
Custom Color Mode (originalColors: false):
- Uses
colorFrontfor dots andcolorBackfor background - Creates monochrome or duotone effect
- Best for stylized looks
originalColors: true):
- Preserves image colors in halftone pattern
- Adjusts
radiusandcontrastautomatically - Best for realistic halftone prints
Performance Notes
- Static shader (no animation by default)
- Performance depends on
size(smaller = slower) gooeyandsofttypes sample multiple cells- Grain effects have minimal performance impact
- Works best with moderate
sizevalues (0.3-0.7)
