El Jonathan Mayunga
2.1K posts

El Jonathan Mayunga
@ElJo_Mayunga
Mobile & Web Developer | Tech Fan | Food Lover | Computer Geek | #RMFC | Music | Likes to #GSD #angularDev






CSS Trick! 🫶 You can make use of calc and custom properties to create that dynamic colored glowy spotlight effect 🎨 [data-glow] { --hue: calc(var(--base) + (var(--xp) * var(--spread))); } Let me show you how! 👇 Few tricks and tips in this video/demo. In addition to using mask-composite and background-attachment: fixed, passing both the pointer position and its position along an axis allows you to make the spotlight color dynamic 🔥 Setting --x and --xp inside a single JavaScript pointermove event listener allows you to play with pointer position in your CSS ✨ --xp = 0-1 along the x-axis (x / window.innerWidth) --x = pointerX --base = starting hue 0-359 --spread = variation in hue that's calculated with --xp Hopefully, this video breaks things down a little for you and clears things up 🤞 If not, leave me some questions 💙 Created a reduced demo that doesn't have all the configuration stuff. Find the @CodePen link for that below! 👇

Very cool! ⚡️











