Heart Pulse
dotmatrix/dotm-circular-8FreeComponent
Pulse bursts from the center with a dual-beat cadence, sending soft concentric pressure waves across the circular matrix.
Install it
npx shadcn@latest add https://dotmatrix.zzzzshawn.cloud/r/dotm-circular-8.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 DotmCircular8Props = DotMatrixCommonProps;1314const BASE_OPACITY = 0.08;15const PULSE_CORE = 0.95;16const PULSE_RING = 0.44;1718export function DotmCircular8({19 speed = 1.95,20 animated = true,21 hoverAnimated = false,22 ...rest23}: DotmCircular8Props) {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: 1400,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 radius = Math.hypot(x, y);45 const beat = reducedMotion || p === "idle" ? 0 : Math.sin((phase) * Math.PI * 2);46 const spike = reducedMotion || p === "idle" ? 0 : Math.sin((phase) * Math.PI * 4);47 const pulse = Math.max(0, beat) + Math.max(0, spike) * 0.55;4849 if (radius < 0.55) {50 return { style: { opacity: Math.min(1, 0.35 + pulse * PULSE_CORE) } };51 }52 if (radius < 1.65) {53 return { style: { opacity: 0.16 + pulse * PULSE_RING } };54 }55 return { style: { opacity: BASE_OPACITY + pulse * 0.08 } };56 };57 }, [reducedMotion, phase]);5859 return (60 <DotMatrixBase61 {...rest}62 size={rest.size ?? 36}63 dotSize={rest.dotSize ?? 5}64 speed={speed}65 pattern="full"66 animated={animated}67 phase={matrixPhase}68 onMouseEnter={onMouseEnter}69 onMouseLeave={onMouseLeave}70 reducedMotion={reducedMotion}71 animationResolver={resolver}72 />73 );74}
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 |
