Marquee Along Svg Path
fancy/marquee-along-svg-pathFreeComponent
A ui component.
Install it
npx shadcn@latest add https://www.fancycomponents.dev/r/marquee-along-svg-path.jsonSource
1import React, { RefObject, useCallback, useEffect, useRef } from "react"2import {3 motion,4 SpringOptions,5 useAnimationFrame,6 useMotionValue,7 useScroll,8 useSpring,9 useTransform,10 useVelocity,11} from "motion/react"1213import { cn } from "@/lib/utils"1415// Custom wrap function16const wrap = (min: number, max: number, value: number): number => {17 const range = max - min18 return ((((value - min) % range) + range) % range) + min19}2021type PreserveAspectRatioAlign =22 | "none"23 | "xMinYMin"24 | "xMidYMin"25 | "xMaxYMin"26 | "xMinYMid"27 | "xMidYMid"28 | "xMaxYMid"29 | "xMinYMax"30 | "xMidYMax"31 | "xMaxYMax"3233interface CSSVariableInterpolation {34 property: string35 from: number | string36 to: number | string37}3839type PreserveAspectRatioMeetOrSlice = "meet" | "slice"4041type PreserveAspectRatio =42 | PreserveAspectRatioAlign43 | `${Exclude<PreserveAspectRatioAlign, "none">} ${PreserveAspectRatioMeetOrSlice}`4445interface MarqueeAlongSvgPathProps {46 children: React.ReactNode47 className?: string4849 // Path properties50 path: string51 pathId?: string52 preserveAspectRatio?: PreserveAspectRatio53 showPath?: boolean5455 // SVG properties56 width?: string | number57 height?: string | number58 viewBox?: string5960 // Marquee properties61 baseVelocity?: number62 direction?: "normal" | "reverse"63 easing?: (value: number) => number64 slowdownOnHover?: boolean65 slowDownFactor?: number66 slowDownSpringConfig?: SpringOptions6768 // Scroll properties69 useScrollVelocity?: boolean70 scrollAwareDirection?: boolean71 scrollSpringConfig?: SpringOptions72 scrollContainer?: RefObject<HTMLElement | null> | HTMLElement | null7374 // Item repetition75 repeat?: number7677 // Drag properties78 draggable?: boolean79 dragSensitivity?: number80 dragVelocityDecay?: number81 dragAwareDirection?: boolean82 grabCursor?: boolean8384 // Z-index properties85 enableRollingZIndex?: boolean86 zIndexBase?: number87 zIndexRange?: number8889 cssVariableInterpolation?: CSSVariableInterpolation[]9091 // Responsive properties92 responsive?: boolean93}9495const MarqueeAlongSvgPath = ({96 children,97 className,9899 // Path defaults100 path,101 pathId,102 preserveAspectRatio = "xMidYMid meet",103 showPath = false,104105 // SVG defaults106 width = "100%",107 height = "100%",108 viewBox = "0 0 100 100",109110 // Marquee defaults111 baseVelocity = 5,112 direction = "normal",113 easing,114 slowdownOnHover = false,115 slowDownFactor = 0.3,116 slowDownSpringConfig = { damping: 50, stiffness: 400 },117118 // Scroll defaults119// … truncated
What it pulls in
npm packages
Files it writes
More from fancy
All 158 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Gradient With Svganimated-gradient-with-svg | fancy | Components | Free | no deps | |
| Basic Number Tickerbasic-number-ticker | fancy | Components | Free | 1 dep | |
| Box Carouselbox-carousel | fancy | Components | Free | 1 dep | |
| Breathing Textbreathing-text | fancy | Components | Free | 1 dep | |
| Circling Elementscircling-elements | fancy | Components | Free | 1 dep | |
| Css Boxcss-box | fancy | Components | Free | 1 dep | |
| Cursor Attractor And Gravitycursor-attractor-and-gravity | fancy | Components | Free | 5 deps | |
| Drag Elementsdrag-elements | fancy | Components | Free | 1 dep |
