Oil Slick
NewCustomize
Colors
Scale1.00
Warp1.00
Perspective0.80
Fringes1.00
Darkness0.50
Dust0.50
Speed1.0
Grain0.200
Stir1.00
Installation
npx shadcn@latest add https://uibrik.com/r/oil-slick.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/oil-slick/oil-slick.tsx"use client"; import type { CSSProperties, ReactNode } from "react"; import { ShaderSurface } from "../_shader-background/ShaderSurface"; import { paletteOf, type ShadeStep } from "../_shader-background/shades"; // Light on a film of oil spreading over dark water, shot on grainy film. A field of noise is // warped twice through itself, so it pulls into long folds and eddies, and squeezed toward the top // of the frame as though the surface ran off to a horizon. How thick the film is there picks a // colour from the palette as a ramp: where it thins out the water shows through black, and moving // up in thickness the colour runs through blue and gold to orange and pink, with faint interference // fringes rippling through the bands. Heavy grain with a little colour in it, and a few specks of // dust and the odd scratch that flicker as a projector's would. The pointer stirs the film. const SHADER = /* glsl */ ` uniform float u_scale; // size of the folds uniform float u_warp; // how far the film folds through itself uniform float u_perspective; // how strongly the surface runs off toward the top uniform float u_fringes; // strength of the interference fringes uniform float u_water; // how much of the water shows through uniform float u_dust; // dust specks and scratches uniform float u_stir; // how strongly the pointer stirs the film vec3 shade(vec2 frag) { float t = u_time * 0.05;
Adds the files to
components/uibrik/oil-slick. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/oil-slick.Usage
import { OilSlick } from "@/components/uibrik/oil-slick/oil-slick";const colors = ["#161414", "#262b6e", "#5269cf", "#c4a271", "#c95c46", "#e8a598"];<OilSlick colors={colors} scale={1} warp={1} perspective={0.8} fringes={1} darkness={0.5} dust={0.5} speed={1} grain={0.2} animate interactive stir={1}> …</OilSlick>Props
OilSlick- colors
- Type string[]
- ["#161414","#262b6e","#5269cf","#c4a271","#c95c46","#e8a598"]
- Hex colours, 2 to 6, from bare dark water to the brightest sheen.
- color
- Type string
- "#e2583e"
- One colour drawn in shades instead of colors.
- scale
- Type number
- 1
- Size of the folds; larger is broader and calmer.
- warp
- Type number
- 1
- How far the film folds through itself.
- perspective
- Type number
- 0.8
- How strongly the surface runs off toward the top, like a horizon; 0 is flat on.
- fringes
- Type number
- 1
- Strength of the interference fringes through the colour bands.
- darkness
- Type number
- 0.5
- How much of the dark water shows through the film.
- dust
- Type number
- 0.5
- Dust specks and hairline scratches, like old film; 0 is clean.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- grain
- Type number
- 0.2
- Film grain strength.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- interactive
- Type boolean
- true
- Stir the film with the pointer.
- stir
- Type number
- 1
- How strongly the pointer stirs the film.
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.