zoukankan      html  css  js  c++  java
  • canvas-7global.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <body>
        <canvas id="canvas" style="margin:0 auto;border:1px #ddd solid">
            The current browser does not support Canvas, can replace the browser a try!
        </canvas>
    
        <script>
    
            window.onload = function(){
                var canvas = document.getElementById('canvas');
    
                canvas.width = 1024;
                canvas.height = 768;
    
                if(canvas.getContext('2d')){
                    var context = canvas.getContext('2d');
    
                    // 整个系统的透明度设置
                    context.globalAlpha = 0.7;
    
                    for(var i=0;i<100;i++){
                        var R = Math.floor(Math.random()*255);
                        var G = Math.floor(Math.random()*255);
                        var B = Math.floor(Math.random()*255);
    
                        context.fillStyle = "rgb(" + R + "," + G + "," + B + ")";
    
                        context.beginPath();
                            context.arc(Math.random()*canvas.width,Math.random()*canvas.height,Math.random()*100,0,2*Math.PI)
                        context.closePath();
    
                        context.fill();
                    }
    
                }else{
                    alert('当前游览器不支持Canvas,请更换游览器后再试!');
                }
            }
    
        </script>
    </body>
    <script>
        /*global
    
            globalAlpha
    
            globalCompositeOperation  = "source-over"(default)
                                        sourse-atop
                                        sourse-in
                                        sourse-out
    
                                        destination-over  //前面绘制的覆盖了后面绘制的图形
                                        destination-atop
                                        destination-in
                                        destination-out
    
                                        lighter
                                        copy
                                        xor
                    
        */
    </script>
    </html>
  • 相关阅读:
    bzoj2763 [JLOI]飞行路线 分层图最短路
    [模板]分块/可修改莫队 (数颜色种类)
    gcd步数
    洛谷2378 因式分解 字符串
    bzoj1090 字符串折叠
    洛谷1034 NOIP2002 矩形覆盖
    Codeforces#441 Div.2 四*题
    SPFA的小优化
    洛谷1073 NOIP2009 最优贸易
    bzoj2100 [Usaco2010 DEC]Apple Delivery苹果贸易
  • 原文地址:https://www.cnblogs.com/cynthia-wuqian/p/4988522.html
Copyright © 2011-2022 走看看