茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    html5實(shí)現(xiàn)canvas陰影效果示例
    來(lái)源:易賢網(wǎng) 閱讀:1704 次 日期:2014-07-14 10:44:43
    溫馨提示:易賢網(wǎng)小編為您整理了“html5實(shí)現(xiàn)canvas陰影效果示例”,方便廣大網(wǎng)友查閱!

    在HTML5中實(shí)現(xiàn)Canvas陰影效果

    代碼如下:

    <!DOCTYPE html>

    <html>

    <head>

    <meta http-equiv="X-UA-Compatible" content="chrome=IE8">

    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">

    <title>Canvas Clip Demo</title>

    <link href="default.css" rel="stylesheet" />

    <script>

    var ctx = null; // global variable 2d context

    var imageTexture = null;

    window.onload = function() {

    var canvas = document.getElementById("text_canvas");

    console.log(canvas.parentNode.clientWidth);

    canvas.width = canvas.parentNode.clientWidth;

    canvas.height = canvas.parentNode.clientHeight;

    if (!canvas.getContext) {

    console.log("Canvas not supported. Please install a HTML5 compatible browser.");

    return;

    }

    var context = canvas.getContext('2d');

    // section one - shadow and blur

    context.fillStyle="black";

    context.fillRect(0, 0, canvas.width, canvas.height/4);

    context.font = '60pt Calibri';

    context.shadowColor = "white";

    context.shadowOffsetX = 0;

    context.shadowOffsetY = 0;

    context.shadowBlur = 20;

    context.fillText("Blur Canvas", 40, 80);

    context.strokeStyle = "RGBA(0, 255, 0, 1)";

    context.lineWidth = 2;

    context.strokeText("Blur Canvas", 40, 80);

    // section two - shadow font

    var hh = canvas.height/4;

    context.fillStyle="white";

    context.fillRect(0, hh, canvas.width, canvas.height/4);

    context.font = '60pt Calibri';

    context.shadowColor = "RGBA(127,127,127,1)";

    context.shadowOffsetX = 3;

    context.shadowOffsetY = 3;

    context.shadowBlur = 0;

    context.fillStyle = "RGBA(0, 0, 0, 0.8)";

    context.fillText("Blur Canvas", 40, 80+hh);

    // section three - down shadow effect

    var hh = canvas.height/4 + hh;

    context.fillStyle="black";

    context.fillRect(0, hh, canvas.width, canvas.height/4);

    for(var i = 0; i < 10; i++)

    {

    context.shadowColor = "RGBA(255, 255, 255," + ((10-i)/10) + ")";

    context.shadowOffsetX = i*2;

    context.shadowOffsetY = i*2;

    context.shadowBlur = i*2;

    context.fillStyle = "RGBA(127, 127, 127, 1)";

    context.fillText("Blur Canvas", 40, 80+hh);

    }

    // section four - fade effect

    var hh = canvas.height/4 + hh;

    context.fillStyle="green";

    context.fillRect(0, hh, canvas.width, canvas.height/4);

    for(var i = 0; i < 10; i++)

    {

    context.shadowColor = "RGBA(255, 255, 255," + ((10-i)/10) + ")";

    context.shadowOffsetX = 0;

    context.shadowOffsetY = -i*2;

    context.shadowBlur = i*2;

    context.fillStyle = "RGBA(127, 127, 127, 1)";

    context.fillText("Blur Canvas", 40, 80+hh);

    }

    for(var i = 0; i < 10; i++)

    {

    context.shadowColor = "RGBA(255, 255, 255," + ((10-i)/10) + ")";

    context.shadowOffsetX = 0;

    context.shadowOffsetY = i*2;

    context.shadowBlur = i*2;

    context.fillStyle = "RGBA(127, 127, 127, 1)";

    context.fillText("Blur Canvas", 40, 80+hh);

    }

    for(var i = 0; i < 10; i++)

    {

    context.shadowColor = "RGBA(255, 255, 255," + ((10-i)/10) + ")";

    context.shadowOffsetX = i*2;

    context.shadowOffsetY = 0;

    context.shadowBlur = i*2;

    context.fillStyle = "RGBA(127, 127, 127, 1)";

    context.fillText("Blur Canvas", 40, 80+hh);

    }

    for(var i = 0; i < 10; i++)

    {

    context.shadowColor = "RGBA(255, 255, 255," + ((10-i)/10) + ")";

    context.shadowOffsetX = -i*2;

    context.shadowOffsetY = 0;

    context.shadowBlur = i*2;

    context.fillStyle = "RGBA(127, 127, 127, 1)";

    context.fillText("Blur Canvas", 40, 80+hh);

    }

    }

    </script>

    </head>

    <body>

    <h1>HTML5 Canvas</h1>

    <pre>Fill And Stroke Clip</pre>

    <div id="my_painter">

    <canvas id="text_canvas"></canvas>

    </div>

    </body>

    </html>

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看網(wǎng)頁(yè)制作
    易賢網(wǎng)手機(jī)網(wǎng)站地址:html5實(shí)現(xiàn)canvas陰影效果示例
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢?yōu)闇?zhǔn)!
    相關(guān)閱讀網(wǎng)頁(yè)制作

    2026國(guó)考·省考課程試聽(tīng)報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)