HTML 캔버스의 shadowBlur 속성은 그림자의 흐림 수준을 설정하는 데 사용됩니다. 기본값은 0입니다.
다음은 구문입니다 -
ctx.shadowBlur=num;
위의 숫자는 그림자의 흐림 수준을 나타냅니다.
이제 캔버스의 shadowBlur 속성을 구현하는 예를 살펴보겠습니다 -
예시
<!DOCTYPE html>
<html>
<body>
<canvas id="newCanvas" width="600" height="350" style="border:2px solid orange;">
</canvas>
<script>
var c = document.getElementById("newCanvas");
var ctx = c.getContext("2d");
ctx.shadowBlur = 20;
ctx.shadowColor = "black";
ctx.fillStyle = "green";
ctx.fillRect(40, 40, 100, 250);
ctx.shadowBlur = 30;
ctx.shadowColor = "blue";
ctx.fillStyle = "orange";
ctx.fillRect(200, 40, 200, 150);
</script>
</body>
</html> 출력
