tan
A periodic, non-linear math function whose value changes abruptly as it approaches infinity. Ideal for generating repeating patterns with sharp edges or 'jumpy' animation effects.
Core Advantages
Efficiently generates resolution-independent visual content programmatically on the GPU. It excels at leveraging its functional properties to create patterns with sharp edges or abrupt effects (like glitch art, wood grain) that are difficult to simulate with smooth functions, all without requiring textures.
Common Uses
Generating sharp stripes, wood grain, or glitch art patterns
Creating non-linear, 'jumpy' vertex displacement animations
Adding unique perturbations or distortion effects to UV coordinates
How to adjust
Adjust by performing math operations on the `tan` input. Multiplying by a constant changes the pattern's repetition frequency (density); adding a time-varying value (like `timer()`) creates a scrolling animation effect.
Code Examples
1// Generates a value that repeats and jumps sharply.
2// Creates scrolling horizontal stripes from UVs.
3const pattern = tan( uv().y.mul(10).add( timer() ) );