• [ html canvas 透明度 globalApha ] canvas绘图属性 透明度 globalApha 属性演示


     1 <!DOCTYPE html>
     2 <html lang='zh-cn'>
     3 <head>
     4 <title>Insert you title</title>
     5 <meta name='description' content='this is my page'>
     6 <meta name='keywords' content='keyword1,keyword2,keyword3'>
     7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     8 <link rel='stylesheet' type='text/css' href='./css/index.css' />
     9 <script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
    10 <style type='text/css'>
    11 html,body,canvas,div,select,option {
    12     margin: 0; padding: 0;
    13 }
    14 
    15 html {
    16     height: 100%;
    17 }
    18 
    19 body {
    20     background: #666;
    21 }
    22 
    23 #can {
    24     display: block; margin: 25px auto; background: #FFF; border-radius: 2px;
    25 }
    26 </style>
    27 <script type='text/javascript'>
    28     $( document ).ready( function(){
    29         var can = $( '#can' ).get( 0 );
    30         var oCan = can.getContext( '2d' );
    31         oCan.beginPath();
    32         oCan.fillStyle = '#F00';
    33         oCan.fillRect( 100 , 100 , 100 , 100 );
    34         oCan.save();
    35         oCan.globalAlpha = .5;
    36         oCan.fillStyle = '#0F0';
    37         oCan.fillRect( 150 , 150 , 100 , 100 );
    38         oCan.restore();
    39         oCan.closePath();
    40     } )
    41 </script>
    42 </head>
    43 <body>
    44     <canvas id='can' width='500' height='450'>检测到您的浏览器版本过低请升级您的浏览器以获取更好的用户体验...</canvas>
    45 </body>
    46 </html>
  • 相关阅读:
    go语言的特殊变量 iota
    JS设计模式(三) 数据访问对象模式
    SSM之整合Redis
    JS设计模式(二) 惰性模式
    Ubuntu 安装 SQL Server
    JS设计模式(一) 单例模式
    JavaScript 面向对象编程
    SSM之框架整合
    Java实现CORS跨域请求
    数据库记录删除方式
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5936402.html
Copyright © 2020-2023  润新知