airplane
lucide-animated-icons/airplaneFreeComponent
lucide-animated publishes no description for this item.
Install it
npx shadcn@latest add https://icons.pqoqubbw.dev/r/airplane.jsonSource
1"use client";23import { motion, useAnimation } from "motion/react";4import type { HTMLAttributes } from "react";5import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";67import { cn } from "@/lib/utils";89export interface AirplaneIconHandle {10 startAnimation: () => void;11 stopAnimation: () => void;12}1314interface AirplaneIconProps extends HTMLAttributes<HTMLDivElement> {15 size?: number;16}1718const SPEED_LINES = [19 { x1: 5, y1: 15, x2: 1, y2: 19, delay: 0.1 },20 { x1: 7, y1: 17, x2: 3, y2: 21, delay: 0.2 },21 { x1: 9, y1: 19, x2: 5, y2: 23, delay: 0.3 },22];2324const AirplaneIcon = forwardRef<AirplaneIconHandle, AirplaneIconProps>(25 ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {26 const controls = useAnimation();27 const isControlledRef = useRef(false);2829 useImperativeHandle(ref, () => {30 isControlledRef.current = true;3132 return {33 startAnimation: () => controls.start("animate"),34 stopAnimation: () => controls.start("normal"),35 };36 });3738 const handleMouseEnter = useCallback(39 (e: React.MouseEvent<HTMLDivElement>) => {40 if (isControlledRef.current) {41 onMouseEnter?.(e);42 } else {43 controls.start("animate");44 }45 },46 [controls, onMouseEnter]47 );4849 const handleMouseLeave = useCallback(50 (e: React.MouseEvent<HTMLDivElement>) => {51 if (isControlledRef.current) {52 onMouseLeave?.(e);53 } else {54 controls.start("normal");55 }56 },57 [controls, onMouseLeave]58 );5960 return (61 <div62 className={cn(className)}63 onMouseEnter={handleMouseEnter}64 onMouseLeave={handleMouseLeave}65 {...props}66 >67 <svg68 className="overflow-visible"69 fill="none"70 height={size}71 stroke="currentColor"72 strokeLinecap="round"73 strokeLinejoin="round"74 strokeWidth="2"75 viewBox="0 0 24 24"76 width={size}77 xmlns="http://www.w3.org/2000/svg"78 >79 <motion.path80 animate={controls}81 d="M17.8 19.2L16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"82 transition={{83 duration: 0.5,84 }}85 variants={{86 normal: { x: 0, y: 0, scale: 1 },87// … truncated
What it pulls in
npm packages
Files it writes
More from lucide-animated
All 466 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| a-arrow-downa-arrow-down | lucide-animated | Components | Free | 1 dep | |
| a-arrow-upa-arrow-up | lucide-animated | Components | Free | 1 dep | |
| accessibilityaccessibility | lucide-animated | Components | Free | 1 dep | |
| activityactivity | lucide-animated | Components | Free | 1 dep | |
| air-ventair-vent | lucide-animated | Components | Free | 1 dep | |
| airplayairplay | lucide-animated | Components | Free | 1 dep | |
| alarm-clockalarm-clock | lucide-animated | Components | Free | 1 dep | |
| alarm-clock-checkalarm-clock-check | lucide-animated | Components | Free | 1 dep |
