Loading

Canvas 阴影效果

shadow

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>shadow</title>
</head>

<body>
    <canvas id='myCanvas' width='800' height='600'>
        your browser does not support canvas
    </canvas>
    <script type="text/javascript">
    var c = document.getElementById('myCanvas');
    var ctx = c.getContext('2d');
    ctx.shadowColor = '#ff0000';
    ctx.shadowBlur = 10;
    ctx.shadowOffsetX = 20;
    ctx.shadowOffsetY = 30;
    var img = new Image();
    img.src = 'face.jpg';
    img.onload = function() {
        ctx.drawImage(img, 0, 0);
    };
    </script>
</body>

</html>

 

posted @ 2015-07-24 11:00  stono  阅读(248)  评论(0编辑  收藏  举报