Lunar Breathe
dotmatrix/dotm-circular-11FreeComponent
A rotating crescent moon silhouette: bright lunar body, soft rim, and faint directional halo moving around the circular mask.
Install it
npx shadcn@latest add https://dotmatrix.zzzzshawn.cloud/r/dotm-circular-11.jsonSource
1"use client";23import { useMemo } from "react";45import { DotMatrixBase } from "@/components/ui/dotmatrix-core";6import { useDotMatrixPhases } from "@/components/ui/dotmatrix-hooks";7import { isWithinCircularMask } from "@/components/ui/dotmatrix-core";8import { useCyclePhase } from "@/components/ui/dotmatrix-hooks";9import { usePrefersReducedMotion } from "@/components/ui/dotmatrix-hooks";10import type { DotAnimationResolver, DotMatrixCommonProps } from "@/components/ui/dotmatrix-core";1112export type DotmCircular11Props = DotMatrixCommonProps;1314const BASE_OPACITY = 0.07;15const MID_OPACITY = 0.3;16const HIGH_OPACITY = 0.95;1718export function DotmCircular11({19 speed = 1.65,20 animated = true,21 hoverAnimated = false,22 ...rest23}: DotmCircular11Props) {24 const reducedMotion = usePrefersReducedMotion();25 const { phase: matrixPhase, onMouseEnter, onMouseLeave } = useDotMatrixPhases({26 animated: Boolean(animated && !reducedMotion),27 hoverAnimated: Boolean(hoverAnimated && !reducedMotion),28 speed29 });30 const phase = useCyclePhase({31 active: !reducedMotion && matrixPhase !== "idle",32 cycleMsBase: 1850,33 speed34 });3536 const resolver = useMemo<DotAnimationResolver>(() => {37 return ({ row, col, phase: p }) => {38 if (!isWithinCircularMask(row, col)) {39 return { className: "dmx-inactive" };40 }4142 const x = col - 2;43 const y = row - 2;44 const ring = Math.sqrt(x * x + y * y);45 const t = reducedMotion || p === "idle" ? 0 : (phase) * Math.PI * 2;46 const angle = Math.atan2(y, x);47 const moonCenterX = Math.cos(t) * 0.7;48 const moonCenterY = Math.sin(t) * 0.7;49 const body = Math.hypot(x - moonCenterX, y - moonCenterY);50 const cutCenterX = moonCenterX + Math.cos(t) * 0.82;51 const cutCenterY = moonCenterY + Math.sin(t) * 0.82;52 const cut = Math.hypot(x - cutCenterX, y - cutCenterY);53 const rim = Math.max(0, 1 - Math.abs(body - 1.55) / 0.35);54 const halo = Math.max(0, 1 - Math.acos(Math.cos(angle - t)) / 0.9);5556 let opacity = BASE_OPACITY;57 if (body < 1.55 && cut > 1.05) {58 opacity = HIGH_OPACITY;59 } else if (rim > 0.5) {60 opacity = MID_OPACITY + rim * 0.22;61 } else if (halo > 0.68 && ring > 1.2) {62 opacity = MID_OPACITY;63 }6465 return { style: { opacity: Math.min(HIGH_OPACITY, opacity) } };66 };67 }, [reducedMotion, phase]);6869 return (70 <DotMatrixBase71 {...rest}72 size={rest.size ?? 36}73// … truncated
More from @dotmatrix
All 91 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| All Dot Matrix Loadersall | @dotmatrix | Components | Free | no deps | |
| Square Spiraldotm-3x3-1 | @dotmatrix | Components | Free | no deps | |
| Frame Chasedotm-3x3-10 | @dotmatrix | Components | Free | no deps | |
| Glyph Pulsedotm-3x3-11 | @dotmatrix | Components | Free | no deps | |
| Drop Rippledotm-3x3-12 | @dotmatrix | Components | Free | no deps | |
| Right Surgedotm-3x3-13 | @dotmatrix | Components | Free | no deps | |
| Comet Traildotm-3x3-14 | @dotmatrix | Components | Free | no deps | |
| Echo Ringsdotm-3x3-15 | @dotmatrix | Components | Free | no deps |
