Letter 3d Swap Explanation Top Demo
fancy/letter-3d-swap-explanation-top-demoFreeBlock
A block component.
Install it
npx shadcn@latest add https://www.fancycomponents.dev/r/letter-3d-swap-explanation-top-demo.jsonSource
1/*2 * If you're reading this file, you're probably looking for the explanation demo.3 * Keep in my mind this demo contains some extra transforms that are only needed4 * for making the animation prettier, and not necessary for the actual functionality.5 * There is a lot of messy code here, so I advise you not to try learn from it.6 * Please refer to the actual documentation for more details.7 */8"use client"910import { useEffect, useState } from "react"11import { AnimatePresence, motion } from "motion/react"1213interface AxisHelperProps {14 axisLength: number15}1617export const AxisHelper = ({ axisLength }: AxisHelperProps) => {18 // Arrowhead size19 const arrowSize = 122021 return (22 <div23 className="pointer-events-none transform-3d"24 style={{25 transform: "translateY(-100px) translateZ(-100px) translateX(-100px)",26 }}27 >28 {/* X axis (red, right) */}29 <svg30 width={axisLength + arrowSize}31 height={arrowSize * 2}32 style={{33 position: "absolute",34 left: 0,35 top: 0,36 transform: `translateY(-${arrowSize}px)`,37 }}38 >39 <line40 x1={0}41 y1={arrowSize}42 x2={axisLength}43 y2={arrowSize}44 stroke="currentColor"45 strokeOpacity="0.6"46 strokeWidth={2}47 strokeDasharray="6,4"48 />49 <polygon50 points={`51 ${axisLength},${arrowSize}52 ${axisLength - arrowSize},${arrowSize - 5}53 ${axisLength - arrowSize},${arrowSize + 5}54 `}55 fill="currentColor"56 />57 </svg>5859 {/* Y axis (green, up) */}60 <svg61 width={arrowSize * 10}62 height={axisLength + arrowSize}63 style={{64 position: "absolute",65 left: 0,66 top: 0,67 transform: `translateX(-${arrowSize}px) translateY(-${axisLength}px)`,68 }}69 >70 <line71 x1={arrowSize}72 y1={axisLength}73 x2={arrowSize}74 y2={0}75 stroke="currentColor"76 strokeOpacity="0.6"77 strokeWidth={2}78 strokeDasharray="6,4"79 />80 <polygon81 points={`82 ${arrowSize},083 ${arrowSize - 5},${arrowSize}84 ${arrowSize + 5},${arrowSize}85 `}86 fill="currentColor"87 />88 </svg>8990 <svg91 width={arrowSize * 2}92 height={axisLength + arrowSize}93 style={{94// … truncated
What it pulls in
npm packages
Files it writes
More from fancy
All 158 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Gradient Demoanimated-gradient-demo | fancy | Blocks | Free | no deps | |
| Basic Number Ticker Demobasic-number-ticker-demo | fancy | Blocks | Free | no deps | |
| Box Carousel Autoplay Demobox-carousel-autoplay-demo | fancy | Blocks | Free | 1 dep | |
| Box Carousel Demobox-carousel-demo | fancy | Blocks | Free | 1 dep | |
| Box Carousel Video Demobox-carousel-video-demo | fancy | Blocks | Free | 1 dep | |
| Breathing Text Demobreathing-text-demo | fancy | Blocks | Free | no deps | |
| Circling Elements Democircling-elements-demo | fancy | Blocks | Free | no deps | |
| Circling Elements Easing Democircling-elements-easing-demo | fancy | Blocks | Free | no deps |
