zoukankan      html  css  js  c++  java
  • html5 canvas ( 图形的阴影 ) shadowColor, shadowOffsetX, shadowOffsetY, shadowNlur

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>canvas</title>
        <script type="text/javascript" src="../js/jQuery.js"></script>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
                outline: none;
                border: none;
            }
            #canvas{
                width: 7rem;
                margin: .25rem 0 0 1.5rem;
                border: 1px solid black;
            }
        </style>
    </head>
    <body> 
        <canvas id="canvas" width="1000" height="600"></canvas>
    </body>
    </html>
    <script type="text/javascript">
        /**
         * rem 布局初始化
         */
        $('html').css('font-size', $(window).width()/10);
        /**
         * 获取 canvas 画布
         * 获取 canvas 绘图上下文环境
         */
        var canvas = $('#canvas')[0];
        var cxt = canvas.getContext('2d');
        
        /**
         * 阴影
         * shadowColor: 阴影的颜色
         * shadowOffsetX: 横向偏移
         * shadowOffsetY: 纵向偏移
         * shadowNlur: 模糊程度
         */
        cxt.shadowColor = "red";
        cxt.shadowOffsetX = 20;
        cxt.shadowOffsetY = 20;
        cxt.shadowBlur = 0;
        cxt.fillRect(200, 200, 400, 200);
    </script>
  • 相关阅读:
    [CLYZ2017]day8
    [CLYZ2017]day12
    [bzoj1503][NOI2004]郁闷的出纳员
    [CLYZ2017]day18
    [CLYZ2017]day11
    [CLYZ2017]day17
    在DLL中获取服务器路径
    SPSecurity.RunWithElevatedPrivileges 拒绝访问
    prototype1.4.0(转载)
    删除多表数据
  • 原文地址:https://www.cnblogs.com/lovling/p/6648876.html
Copyright © 2011-2022 走看看