From 9d0b1f0171b2f072a573143c68f3a589de70efd5 Mon Sep 17 00:00:00 2001 From: Asdqwe Date: Mon, 21 Oct 2024 04:47:19 -0300 Subject: [PATCH] Adds SetWindowOpacity() implementation for PLATFORM_WEB (#4403) --- src/platforms/rcore_web.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index c41094446935..36af66a4787e 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -673,7 +673,9 @@ void SetWindowSize(int width, int height) // Set window opacity, value opacity is between 0.0 and 1.0 void SetWindowOpacity(float opacity) { - TRACELOG(LOG_WARNING, "SetWindowOpacity() not available on target platform"); + if (opacity >= 1.0f) opacity = 1.0f; + else if (opacity <= 0.0f) opacity = 0.0f; + EM_ASM({ document.getElementById('canvas').style.opacity = $0; }, opacity); } // Set window focused