Halftone Horizon
Customize
Color
top
Curve1.00
Reach1.00
Softness1.10
Spacing7.0px
Dot size1.00
Min dot0.25
Dots0.70
Speed1.0
Grain0.040
Seed0
Radius120px
Lens0.60
Trail length1.2s
Follow0.40
Installation
npx shadcn@latest add https://uibrik.com/r/halftone-horizon.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/halftone-horizon/halftone-horizon.tsx"use client"; import { ShaderSurface, type ShaderBackgroundProps } from "../_shader-background/ShaderSurface"; import { paletteOf, type ShadeStep } from "../_shader-background/shades"; // A horizon printed in halftone where it's dark and left smooth where it's light. Night falls from // one edge over a bright horizon, in bands that arch like the edge of a planet (as in Horizon // Gradient). The dark part is a screen of dots: small and dim up in the night, growing as the light // rises until neighbours touch and fuse, leaving only small dark gaps, and then those close too and // the dots melt into the smooth glow. So the halftone and the gradient are one ramp, with no line // where one ends. The gaps take a darker shade of the gradient rather than black, so even the // fused screen stays soft. A slow noise breathes through the bands, and the dots swell and shrink // with it. The pointer acts as strongly as the night is deep: in full near the dark edge, fading // through the bands and gone in the light. Under it the screen bulges like a loupe, magnifying the // dots; its path leaves a trail that prints the smooth light as dots and lifts the dots it // crosses, fading as it goes; and a click sends a ring of swollen dots out across the screen. const SHADER = /* glsl */ ` uniform float u_curve; // how strongly the bands arch uniform float u_reach; // how far the dark reaches uniform float u_softness; // how gradual the bands are uniform float u_direction; // edge the dark comes from: 0 top, 1 right, 2 bottom, 3 left uniform float u_cell; // dot spacing, css px uniform float u_dotSize; // dot size, as a share of the spacing uniform float u_minDot; // smallest dot, as a share of the largest
Adds the files to
components/uibrik/halftone-horizon. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/halftone-horizon.Usage
import { HalftoneHorizon } from "@/components/uibrik/halftone-horizon/halftone-horizon";<HalftoneHorizon color="#f0602a" direction="top" curve={1} reach={1} softness={1.1} spacing={7} dotSize={1} minDot={0.25} dots={0.7} speed={1} grain={0.04} seed={0} animate interactive radius={120} lens={0.6} trailLength={1.2} ripples follow={0.4}> …</HalftoneHorizon>Props
HalftoneHorizon- color
- Type string
- "#f0602a"
- Colour of the sky between the dark and the light; drawn in shades of it.
- colors
- Type string[]
- ["#07060f","#231a5c","#6b3fc4","#e2609a","#ffc9a3","#fff8ef"]
- Hex colours, 2 to 6, from the dark edge to the light one. Overrides color.
- direction
- Type "top" | "right" | "bottom" | "left"
- "top"
- Edge the dark comes from; the light gathers at the opposite one.
- curve
- Type number
- 1
- How strongly the bands arch; 0 is nearly level.
- reach
- Type number
- 1
- How far the dark reaches; 1 is the designed height.
- softness
- Type number
- 1.1
- How gradual the bands are; higher spreads them over more of the frame.
- spacing
- Type number
- 7
- Distance between dots.
- dotSize
- Type number
- 1
- Dot size, as a share of the spacing; 1 lets the dots fuse just before the light.
- minDot
- Type number
- 0.25
- Smallest dot (in the dark), as a share of a full one; 0 lets dark dots vanish.
- dots
- Type number
- 0.7
- How far into the light the halftone reaches; past it the gradient is smooth.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- grain
- Type number
- 0.04
- Film grain strength.
- seed
- Type number
- 0
- Shifts the composition, so two backgrounds with the same settings still differ.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- interactive
- Type boolean
- true
- React to the pointer: the dots bulge under it, its path prints a fading trail of dots, and a click sends out a ring.
- radius
- Type number
- 120
- How far the pointer's light reaches.
- lens
- Type number
- 0.6
- How strongly the dots bulge under the pointer, like a loupe; 0 turns it off.
- trailLength
- Type number
- 1.2
- Seconds the pointer's trail takes to fade.
- ripples
- Type boolean
- true
- A click sends a ring of swollen dots out across the screen.
- follow
- Type number
- 0.4
- How lazily the light follows the pointer, 0 (locked) to 1 (drifts after it).
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.