diff --git a/content/reveal-hover-mask/image.png b/content/reveal-hover-mask/image.png new file mode 100644 index 00000000..1ffb97b5 Binary files /dev/null and b/content/reveal-hover-mask/image.png differ diff --git a/content/reveal-hover-mask/index.md b/content/reveal-hover-mask/index.md new file mode 100644 index 00000000..d6156fd3 --- /dev/null +++ b/content/reveal-hover-mask/index.md @@ -0,0 +1,39 @@ +--- +layout: layouts/post.njk +title: A reveal hover effect using CSS mask +description: Use CSS mask to create a nice reveal effect on hover +date: 2023-07-20 +tags: posts +--- + +Reveal your images with a nice hover effect and a few lines of code +* No extra element (only the `` tag) +* Less than 10 CSS declarations +* Powered by CSS Mask + + +{% image "./image.png", "A reveal hover effect using mask" %} + +```css +img { + padding: 10px; /* control the space for the gradient */ + background: repeating-linear-gradient(45deg,#FF6B6B 0 10px,#4ECDC4 0 20px); + mask: + radial-gradient(#000 70%,#0000 71%) content-box + 50%/var(--_s,150% 150%) no-repeat, + linear-gradient(#000 0 0); + mask-composite: exclude; + transition: .5s; + cursor: pointer; +} +img:hover { + --_s: 0% 0%; +} +``` + +

+ See the Pen + Hover reveal animation using mask by Temani Afif (@t_afif) + on CodePen. +

+ \ No newline at end of file