Last active
September 27, 2024 11:45
-
-
Save ViliamKopecky/4ffc6aeb6d9e4b89fde465f17f010291 to your computer and use it in GitHub Desktop.
DirectionalBlur.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FunctionComponent, PropsWithChildren } from 'react' | |
export const DirectionalBlur: FunctionComponent< | |
PropsWithChildren<{ | |
spread?: number | |
blur?: number | |
rotationDeg?: number | |
}> | |
> = ({ children, spread = 100, blur = 0.5, rotationDeg = 0 }) => { | |
return ( | |
<span | |
style={{ | |
display: 'inline-block', | |
filter: `blur(${blur}em)`, | |
transform: `rotate(${-1 * rotationDeg}deg) scaleY(${1 / spread})`, | |
}} | |
> | |
<span | |
style={{ | |
display: 'inline-block', | |
transform: `scaleY(${spread}) rotate(${rotationDeg}deg)`, | |
}} | |
> | |
{children} | |
</span> | |
</span> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment