Twin Helix
dotmatrix/dotm-circular-13FreeComponent
A circular-masked twin-helix: mirrored side strands weave inward and outward with intermittent interior bridge pulses.
Install it
npx shadcn@latest add https://dotmatrix.zzzzshawn.cloud/r/dotm-circular-13.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 { usePrefersReducedMotion } from "@/components/ui/dotmatrix-hooks";9import { useSteppedCycle } from "@/components/ui/dotmatrix-hooks";10import type { DotAnimationResolver, DotMatrixCommonProps } from "@/components/ui/dotmatrix-core";1112export type DotmCircular13Props = DotMatrixCommonProps;1314const STEP_COUNT = 28;15const BASE_OPACITY = 0.07;16const STRAND_OPACITY = 0.95;17const NEAR_STRAND_OPACITY = 0.5;18const BRIDGE_OPACITY = 0.3;1920export function DotmCircular13({21 speed = 1.55,22 animated = true,23 hoverAnimated = false,24 ...rest25}: DotmCircular13Props) {26 const reducedMotion = usePrefersReducedMotion();27 const { phase: matrixPhase, onMouseEnter, onMouseLeave } = useDotMatrixPhases({28 animated: Boolean(animated && !reducedMotion),29 hoverAnimated: Boolean(hoverAnimated && !reducedMotion),30 speed31 });32 const step = useSteppedCycle({33 active: !reducedMotion && matrixPhase !== "idle",34 cycleMsBase: 1750,35 steps: STEP_COUNT,36 speed,37 });3839 const resolver = useMemo<DotAnimationResolver>(() => {40 return ({ row, col, phase }) => {41 if (!isWithinCircularMask(row, col)) {42 return { className: "dmx-inactive" };43 }4445 const x = col - 2;46 const y = row - 2;47 const t = reducedMotion || phase === "idle" ? 0 : (step / STEP_COUNT) * Math.PI * 2;4849 const strandOffset = Math.sin(y * 1.35 + t * 1.3) * 1.15;50 const leftStrand = -strandOffset;51 const rightStrand = strandOffset;52 const leftDistance = Math.abs(x - leftStrand);53 const rightDistance = Math.abs(x - rightStrand);54 const strandDistance = Math.min(leftDistance, rightDistance);55 const bridgeOn = Math.cos(y * 2 + t * 2.1) > 0.55;56 const isBetweenStrands = x > Math.min(leftStrand, rightStrand) && x < Math.max(leftStrand, rightStrand);5758 let opacity = BASE_OPACITY;59 if (strandDistance < 0.34) {60 opacity = STRAND_OPACITY;61 } else if (strandDistance < 0.8) {62 opacity = NEAR_STRAND_OPACITY;63 } else if (bridgeOn && isBetweenStrands) {64 opacity = BRIDGE_OPACITY;65 }6667 return { style: { opacity } };68 };69 }, [reducedMotion, step]);7071 return (72 <DotMatrixBase73 {...rest}74 size={rest.size ?? 36}75// … 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 |
