July 24, 2023  SEONews

Recreating YouTube’s Ambient Mode Glow Effect — Smashing Magazine


Discover with Adrian what’s behind the charming glow effect on Youtube and how you can use it to make your own videos more immersive. Deconstruct YouTube’s “Ambient Mode” feature and learn how HTML <canvas> and the requestAnimationFrame function are used to create this glowing effect.

I noticed a charming effect on YouTube’s video player while using its dark theme some time ago. The background around the video would change as the video played, creating a lush glow around the video player, making an otherwise bland background a lot more interesting.

This effect is called Ambient Mode. The feature was released sometime in 2022, and YouTube describes it like this:

“Ambient mode uses a lighting effect to make watching videos in the Dark theme more immersive by casting gentle colors from the video into your screen’s background.”
— YouTube

It is an incredibly subtle effect, especially when the video’s colors are dark and have less contrast against the dark theme’s background.

Curiosity hit me, and I set out to replicate the effect on my own. After digging around YouTube’s convoluted DOM tree and source code in DevTools, I hit an obstacle: all the magic was hidden behind the HTML <canvas> element and bundles of mangled and minified JavaScript code.

Despite having very little to go on, I decided to reverse-engineer the code and share my process for creating an ambient glow around the videos. I prefer to keep things simple and accessible, so this article won’t...



source: https://news.oneseocompany.com/2023/07/24/recreating-youtubes-ambient-mode-glow-effect-smashing-magazine_2023072448019.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.