Skip to content

Instantly share code, notes, and snippets.

@ViliamKopecky
Last active September 27, 2024 11:45
Show Gist options
  • Save ViliamKopecky/4ffc6aeb6d9e4b89fde465f17f010291 to your computer and use it in GitHub Desktop.
Save ViliamKopecky/4ffc6aeb6d9e4b89fde465f17f010291 to your computer and use it in GitHub Desktop.
DirectionalBlur.tsx
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