October 05, 2023  SEONews

Re-Creating The Pop-Out Hover Effect With Modern CSS (Part 2) — Smashing Magazine


In a previous article, Temani Afif demonstrated modern CSS features used to re-create an older demo had made in the past. That older demo? It was a fancy hover effect where an avatar pops out of a circle on hover. The challenge was to create the effect using only the <img> tag, and in the process, we witnessed how CSS masks, CSS variables, trigonometric functions, and @property could be combined to achieve the final result. The same techniques will be combined to create a different shape for the frame in this article. The idea is to apply the concepts in a new context and gain another view of how trigonometric functions can influence the way we mask elements in CSS.

The last time we met, I demonstrated how newer CSS features — particularly trigonometric functions — can be leveraged to accomplish a “pop-out” hover effect. This is what we made together:

We are going to redo the demo but with a different shape. Rather than the rounded floral pattern for the frame that the avatar pops out of, we’ll make a starburst pattern instead.

We are going to rely on the same concepts to create this effect, so you will definitely want to read the first part of this little series before continuing. This is more of an opportunity to practice what we learned in a new context. We will still use CSS masks to “draw” the shape with gradients, trigonometric functions, and custom properties.

Drawing The Shape

Creating a starburst shape is a relatively “easy” thing we can create...



source: https://news.oneseocompany.com/2023/10/05/re-creating-the-pop-out-hover-effect-with-modern-css-part-2-smashing-magazine_2023100550971.html

Your content is great. However, if any of the content contained herein violates any rights of yours, including those of copyright, please contact us immediately by e-mail at media[@]kissrpr.com.