iottalk / script.js
SuRuby's picture
Update script.js
bf3d422 verified
Raw
History Blame Contribute Delete
609 Bytes
const brightnessControl = document.getElementById('brightness-control');
const lampShade = document.getElementById('lamp-shade');
brightnessControl.addEventListener('input', function() {
const brightness = brightnessControl.value;
// Adjust lamp brightness by modifying the lamp shade shadow intensity and color
const brightnessValue = brightness / 100;
lampShade.style.boxShadow = `0 0 ${15 * brightnessValue}px rgba(255, 215, 0, ${brightnessValue})`;
lampShade.style.backgroundColor = `rgba(255, 215, 0, ${brightnessValue})`; // Adjust color opacity for brightness effect
});