为了账号安全,请及时绑定邮箱和手机立即绑定

canvas绘图画出了的美团LOGO

标签:
Html/CSS

接下来是用HTML新标签canvas绘图画出了的美团LOGO。

<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">
    <title>canvas练习</title>
</head>  
<body>  
    <canvas id="myfirstcanvas" width="300" height="300">
    </canvas>
    <script type="text/javascript">
    var canvas=document.getElementById('myfirstcanvas');
    canvas.style.backgroundColor="#000000";
    var context=canvas.getContext('2d');
    function drawRoundedRect(x,y,w,h,r,bgcolor){
        context.beginPath();
        context.moveTo(x+r,y);
        context.fillStyle = bgcolor;
        context.arcTo(x+w,y,x+w,y+h,r);
        context.arcTo(x+w,y+h,x,y+h,r);
        context.arcTo(x,y+h,x,y,r);
        context.arcTo(x,y,x+w,y,r);     
        context.closePath();
        context.fill();
    }
    drawRoundedRect(20,20,256,256,15,"#ffffff");
    context.beginPath();
    context.fillStyle="#22C6AB";
    context.arc(148, 148, 100, 0, Math.PI * 2,true);
    context.fill();
    context.beginPath();
    context.font = "60px Arial";
        //设置字体填充颜色
    context.fillStyle = "#ffffff";
    context.fillText("美团", 88, 163);
    </script>
</body>  
</html>  
点击查看更多内容
5人点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
Web前端工程师
手记
粉丝
17
获赞与收藏
96

关注作者,订阅最新文章

阅读免费教程

感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消