Web前端画图

本文介绍了如何利用JavaScript在Web前端实现简易的卡通形象绘制,包括皮卡丘和哆啦A梦。通过JavaScript的绘图API,可以创建出有趣的互动图形,为网页增添生动元素。
摘要由CSDN通过智能技术生成

简易皮卡丘

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<canvas id="myCanvas" width="660" height="476" style="background-color:#FFE600" >
		
		</canvas>
		<script type="text/javascript">
		    var c=document.getElementById("myCanvas");
		    var cxt=c.getContext("2d");
		    //右眼
		    cxt.fillStyle="#000";
		    cxt.beginPath();
		    cxt.arc(200,188,30,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    cxt.fillStyle="#FFF";
		    cxt.beginPath();
		    cxt.arc(188,175,11,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    //左眼
		    cxt.fillStyle="#000";
		    cxt.beginPath();
		    cxt.arc(450,188,30,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    cxt.fillStyle="#FFF";
		    cxt.beginPath();
		    cxt.arc(438,175,11,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    //两个晒红
		    cxt.fillStyle="#FF0000";
		    cxt.beginPath();
		    cxt.arc(488,275,35,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    cxt.fillStyle="#FF0000";
		    cxt.beginPath();
		    cxt.arc(162,275,35,0,Math.PI*2,true);
		    cxt.closePath();
		    cxt.fill();
		    //鼻子
		    cxt.fillStyle="#000";
		    cxt.beginPath();
		    cxt.moveTo(328,200);
		    cxt.arc(328,200,11,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值