mirror: Alternating Directional Flow Generator
Mathematical Reflection Through Alternating Periodic Domains
The mirror function creates alternating directional flow by reflecting every other unit interval, generating continuous periodic patterns where adjacent domains exhibit opposite directional behavior. This mathematical transformation produces visual effects where motion and patterns reverse direction at regular intervals.
The mirror function operates through mathematical reflection where the domain maintains ascending fractional progression, while intervals exhibit descending behavior.
Mathematical Definition:
where:
- represents the fractional component
- creates alternating pattern
- The term generates the reflection mechanism
The alternating behavior emerges from the multiplicative interaction between fractional and modular components, creating mathematical domains where:
This mathematical structure enables creation of complex visual phenomena through simple periodic alternation, where spatial or temporal domains exhibit contrasting directional characteristics while maintaining mathematical continuity.
const fragment = () => { const time = iTime.mul(0.7) const coord = uv.mul(8).add(time) const mirroredX = mirror(coord.x) const mirroredY = mirror(coord.y.add(time.mul(0.3))) const wave1 = mirroredX.mul(3.14159).sin() const wave2 = mirroredY.mul(2.71828).cos() const interference = wave1.mul(wave2).abs() const phase = coord.x.add(coord.y).mul(0.5) const colorPhase = mirror(phase.add(time.mul(0.2))) const red = interference.mul(colorPhase.pow(1.5)) const green = interference.mul(colorPhase.sub(0.33).abs().pow(0.8)) const blue = interference.mul(colorPhase.sub(0.66).abs().pow(2)) return vec4(red, green, blue, 1) }