ambulance-icon
itshover/ambulance-iconFreeComponent
itshover publishes no description for this item.
Install it
npx shadcn@latest add https://itshover.com/r/ambulance-icon.jsonSource
1import { forwardRef, useImperativeHandle, useRef } from "react";2import type { AnimatedIconHandle, AnimatedIconProps } from "./types";3import { motion, useAnimate } from "motion/react";45const AmbulanceIcon = forwardRef<AnimatedIconHandle, AnimatedIconProps>(6 (7 { size = 24, color = "currentColor", strokeWidth = 2, className = "" },8 ref,9 ) => {10 const [scope, animate] = useAnimate();11 const animationControls = useRef<Array<ReturnType<typeof animate>>>([]);1213 const start = async () => {14 animationControls.current.forEach((control) => control.stop());15 animationControls.current = [];1617 animationControls.current.push(18 animate(19 ".ambulance",20 { x: [0, 1, 0, -1] },21 { duration: 0.6, ease: "easeInOut", repeat: Infinity },22 ),23 );24 animate(25 ".plus",26 { scale: [1, 1.3, 1] },27 { duration: 0.6, ease: "easeInOut" },28 );29 };3031 const stop = () => {32 animationControls.current.forEach((control) => control.stop());33 animationControls.current = [];3435 animate(".ambulance", { x: 0 }, { duration: 0.2, ease: "easeInOut" });36 animate(".plus", { scale: 1 }, { duration: 0.2, ease: "easeInOut" });37 };3839 useImperativeHandle(ref, () => {40 return {41 startAnimation: start,42 stopAnimation: stop,43 };44 });4546 const handleHoverStart = () => {47 start();48 };4950 const handleHoverEnd = () => {51 stop();52 };5354 return (55 <motion.svg56 ref={scope}57 onHoverStart={handleHoverStart}58 onHoverEnd={handleHoverEnd}59 xmlns="http://www.w3.org/2000/svg"60 width={size}61 height={size}62 viewBox="0 0 24 24"63 fill="none"64 stroke={color}65 strokeWidth={strokeWidth}66 strokeLinecap="round"67 strokeLinejoin="round"68 className={`cursor-pointer ${className}`}69 >70 <motion.g className="ambulance">71 <path d="M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2" />72 <path d="M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14" />73 <path d="M9 18h6" />74 <circle cx="17" cy="18" r="2" />75 <circle cx="7" cy="18" r="2" />76 </motion.g>77 <motion.g className="plus" style={{ transformOrigin: "8px 8px" }}>78 <path d="M10 10H6" />79 <path d="M8 8v4" />80 </motion.g>81 </motion.svg>82// … truncated
What it pulls in
npm packages
Files it writes
More from itshover
All 263 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accessibility-iconaccessibility-icon | itshover | Components | Free | 1 dep · 2 files | |
| airplane-iconairplane-icon | itshover | Components | Free | 1 dep · 2 files | |
| alarm-clock-plus-iconalarm-clock-plus-icon | itshover | Components | Free | 1 dep · 2 files | |
| align-center-iconalign-center-icon | itshover | Components | Free | 1 dep · 2 files | |
| align-vertical-space-around-iconalign-vertical-space-around-icon | itshover | Components | Free | 1 dep · 2 files | |
| ampersand-iconampersand-icon | itshover | Components | Free | 1 dep · 2 files | |
| angry-iconangry-icon | itshover | Components | Free | 1 dep · 2 files | |
| annoyed-iconannoyed-icon | itshover | Components | Free | 1 dep · 2 files |
