zoukankan      html  css  js  c++  java
  • h5-canvas-渐变

    <!DOCTYPE html>
    <html>
    <body>
    
    <canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;">
    Your browser does not support the HTML5 canvas tag.
    </canvas>
    
    <script>
    
    var c=document.getElementById("myCanvas");
    var ctx=c.getContext("2d");
    
    ctx.font="20px '黑体'";
    ctx.fillText("Hello World!",10,120);
    
    ctx.font="30px Arial";
    // Create gradient
    var gradient=ctx.createLinearGradient(0,0,c.width,0);
    gradient.addColorStop("0","tomato");
    gradient.addColorStop("0.5","cyan");
    gradient.addColorStop("1.0","tan");
    // Fill with gradient
    ctx.fillStyle=gradient;
    ctx.fillText("小菜分享",10,90);
    
    </script>
    
    </body>
    </html>

  • 相关阅读:
    02 树莓派的远程连接
    01 树莓派系统安装
    Python正课110 —— Django入门
    作业7 答案
    作业8
    作业7
    作业6
    文件操作
    字符编码
    基本数据类型之集合
  • 原文地址:https://www.cnblogs.com/johnhery/p/9782303.html
Copyright © 2011-2022 走看看