banana-icon
itshover/banana-iconFreeComponent
itshover publishes no description for this item.
Install it
npx shadcn@latest add https://itshover.com/r/banana-icon.jsonSource
1import { forwardRef, useImperativeHandle } from "react";2import type { AnimatedIconHandle, AnimatedIconProps } from "./types";3import { motion, useAnimate } from "motion/react";45const BananaIcon = forwardRef<AnimatedIconHandle, AnimatedIconProps>(6 (7 { size = 24, color = "currentColor", strokeWidth = 2, className = "" },8 ref,9 ) => {10 const [scope, animate] = useAnimate();1112 const start = async () => {13 animate(14 ".peel",15 { pathLength: [0, 1], opacity: [0, 1] },16 { duration: 0.5, ease: "easeOut" },17 );18 await animate(19 ".banana",20 { rotate: [0, -5, 5, -5, 0], y: [0, -2, 0] },21 { duration: 0.6, ease: "easeInOut" },22 );23 };2425 const stop = () => {26 animate(".peel", { pathLength: 1, opacity: 1 }, { duration: 0.2 });27 };2829 useImperativeHandle(ref, () => {30 return {31 startAnimation: start,32 stopAnimation: stop,33 };34 });3536 const handleHoverStart = () => {37 start();38 };3940 const handleHoverEnd = () => {41 stop();42 };4344 return (45 <motion.svg46 ref={scope}47 onHoverStart={handleHoverStart}48 onHoverEnd={handleHoverEnd}49 xmlns="http://www.w3.org/2000/svg"50 width={size}51 height={size}52 viewBox="0 0 24 24"53 fill="none"54 stroke={color}55 strokeWidth={strokeWidth}56 strokeLinecap="round"57 strokeLinejoin="round"58 className={`cursor-pointer ${className}`}59 >60 <motion.path61 className="peel"62 d="M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5"63 initial={{ pathLength: 1, opacity: 1 }}64 />65 <motion.path66 className="banana"67 style={{ transformOrigin: "center" }}68 d="M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z"69 />70 </motion.svg>71 );72 },73);7475BananaIcon.displayName = "BananaIcon";7677export default BananaIcon;
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 | |
| ambulance-iconambulance-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 |
