CSS3-Canvas(陰影)

<!DOCTYPE html5><html lang="en"><head>    <meta charset="UTF-8">    <title>CSS3-Canvas(陰影)</title>    <script>        window.onload=function () {            var canvas=document.getElementById("canvas");//獲取canvas對象            var ctx=canvas.getContext("2d"); //建立二維的繪圖上下文對象              ctx.shadowOffsetX=10;//設計陰影與形狀的水平距離              ctx.shadowOffsetY=10;//設計陰影與形狀的垂直距離              ctx.shadowColor="lightblue";//定義陰影的顏色              ctx.fillStyle="lightpink";              ctx.shadowBlur=10;//定義陰影的模糊級別              ctx.fillRect(50,50,200,100);//定義填充顏色的矩形        }    </script></head><body><h2>Canvas(陰影)</h2><canvas id="canvas" width="500" height="500" style="border:1px solid red ">    瀏覽器不支持canvas</canvas></body></html>
相關文章
相關標籤/搜索