Mask On
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 mask-on --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 MaskOnIcon({ disableHover, className }: Props) {
const classes = [
"ai-mask-on-icon",
disableHover ? "no-hover" : "",
className ?? "",
]
.filter(Boolean)
.join(" ");
return (
<>
<style>{`
.ai-mask-on-icon {
width: 1em;
height: 1em;
display: inline-block;
cursor: pointer;
overflow: visible;
}
.ai-mask-on-icon * {
transform-box: fill-box;
}
.ai-mask-on-icon.no-hover * {
transform: none;
opacity: 1;
animation: none;
}
.ai-mask-on-icon .mask {
transform-box: view-box;
transform-origin: 7.5px 7.5px;
}
.ai-mask-on-icon:not(.no-hover):hover .mask {
animation: ai-mask-on-tilt 700ms ease-in-out;
}
@keyframes ai-mask-on-tilt {
0%, 100% { transform: rotate(0); }
35% { transform: rotate(-4deg); }
70% { transform: rotate(4deg); }
}
`}</style>
<svg
xmlns="http://www.w3.org/2000/svg"
className={classes}
viewBox="0 0 15 15"
fill="none"
>
<path className="mask" d="M14 1C14.5523 1 15 1.44772 15 2V13C15 13.5523 14.5523 14 14 14H1C0.447715 14 2.01331e-08 13.5523 0 13V2C0 1.44772 0.447715 1 1 1H14ZM7.5 4.375C5.77411 4.375 4.375 5.77411 4.375 7.5C4.375 9.22589 5.77411 10.625 7.5 10.625C9.22589 10.625 10.625 9.22589 10.625 7.5C10.625 5.77411 9.22589 4.375 7.5 4.375Z" fill="currentColor"/>
</svg>
</>
);
}