Soft Clouds
NewCustomize
Color
Scale1.00
Cover0.50
Softness1.00
Wind15°
Speed1.0
Grain0.120
Installation
npx shadcn@latest add https://uibrik.com/r/soft-clouds.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/soft-clouds/soft-clouds.tsx"use client"; import type { CSSProperties, ReactNode } from "react"; import { ShaderSurface } from "../_shader-background/ShaderSurface"; import { paletteOf, type ShadeStep } from "../_shader-background/shades"; // A soft summer sky shot on grainy film. Five octaves of noise, gently warped through itself so the // clouds billow instead of blotting, are read through a soft threshold into cloud cover. Each cloud // is lit from above: the same noise read a little higher up says how much cloud sits over a point, // so undersides fall into a cool shade while tops stay white. The sky behind deepens toward the // top and breathes with faint patches. Everything drifts on a slow wind, with the finer billows // changing shape as they go. const SHADER = /* glsl */ ` uniform float u_scale; // size of the clouds uniform float u_cover; // how much of the sky is cloud, 0..1 uniform float u_soft; // how soft the clouds' edges are uniform float u_wind; // direction the clouds drift, radians // the cloud field: x the broad shape (three octaves), y the finer billows (two more), both ~0..1 vec2 fbm(vec2 p, float t) { float base = 0.0; float detail = 0.0; float amp = 0.5; for (int i = 0; i < 5; i++) {
Adds the files to
components/uibrik/soft-clouds. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/soft-clouds.Usage
import { SoftClouds } from "@/components/uibrik/soft-clouds/soft-clouds";<SoftClouds color="#4f93d4" scale={1} cover={0.5} softness={1} wind={15} speed={1} grain={0.12} animate> …</SoftClouds>Props
SoftClouds- color
- Type string
- "#4f93d4"
- Colour of the sky; the clouds are drawn in lighter shades of it.
- colors
- Type string[]
- ["#3d5fa8","#7a8fd0","#e0a6b8","#f6d3c4","#fff6ee"]
- Hex colours, 2 to 6, from the deepest sky to the brightest cloud. Overrides color.
- scale
- Type number
- 1
- Size of the clouds; larger is broader and calmer.
- cover
- Type number
- 0.5
- How much of the sky is cloud.
- softness
- Type number
- 1
- How soft the clouds' edges are.
- wind
- Type number
- 15
- Direction the clouds drift; 0 is to the right.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- grain
- Type number
- 0.12
- Film grain strength.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.