Opacity
Install
npm install @svg-animated-icons/reactCLI
Copy an icon component straight into your project — shadcn-style. Replace {icon} with an icon name like arrow-left.
terminal
npx @svg-animated-icons/cli add {icon} --react| Flag | Description |
|---|---|
--dest <dir> | Destination directory (default: components/animated-icons) |
Or copy the component with the CLI
CLI
npx @svg-animated-icons/cli add opacity --reactCode
React
// Generated by @svg-animated-icons/cli
// You own this file — edit it freely.
import React from "react";
type Props = {
disableHover?: boolean;
className?: string;
};
export function OpacityIcon({ disableHover, className }: Props) {
const classes = [
"ai-opacity-icon",
disableHover ? "no-hover" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<>
<style>{`
.ai-opacity-icon {
width: 1em;
height: 1em;
display: inline-block;
cursor: pointer;
overflow: visible;
}
.ai-opacity-icon * {
transform-box: fill-box;
}
.ai-opacity-icon.no-hover * {
transform: none;
opacity: 1;
animation: none;
}
.ai-opacity-icon .drop {
transform-box: view-box;
transform-origin: 7.5px 1.5px;
}
.ai-opacity-icon:not(.no-hover):hover .drop {
animation: ai-opacity-bob 700ms ease-in-out;
}
@keyframes ai-opacity-bob {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(0.8px); }
}
`}</style>
<svg
xmlns="http://www.w3.org/2000/svg"
className={classes}
viewBox="0 0 15 15"
fill="none"
>
<path className="drop" d="M7.5 1.5C10.5 4.25 12 6.5 12 9C12 11.4853 9.98528 13.5 7.5 13.5C5.01472 13.5 3 11.4853 3 9C3 6.5 4.5 4.25 7.5 1.5ZM7.5 2.87598C5.02773 5.27379 4 7.11234 4 9C4 10.933 5.567 12.5 7.5 12.5C9.433 12.5 11 10.933 11 9C11 7.11234 9.97227 5.27379 7.5 2.87598Z" fill="currentColor"/>
</svg>
</>
);
}