当前位置:网站首页>Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
2022-07-03 09:47:00 【A sack kitten】
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Dragon Boat Festival </title>
<script type="application/javascript">
function draw() {
var canvas = document.getElementById("canvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.font = "48px serif";
ctx.textBaseline = "hanging";
ctx.strokeText(" Eat Zongzi on the Dragon Boat Festival !", 0, 150);
// leaf
ctx.beginPath();
ctx.moveTo(20, 100);
ctx.quadraticCurveTo(150, 150, 300, 70);
ctx.quadraticCurveTo(150, 20, 20, 100);
ctx.fillStyle = "#07C160";
ctx.fill();
// Leaf texture
ctx.beginPath();
ctx.moveTo(20, 100);
ctx.lineTo(300, 70);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(170, 85);
ctx.lineTo(150, 118);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(230, 76);
ctx.lineTo(200, 108);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(230, 76);
ctx.lineTo(200, 50);
ctx.stroke();
// The second zongzi
ctx.beginPath();
ctx.moveTo(150, 0);
ctx.quadraticCurveTo(25, 87, 125, 75);
ctx.quadraticCurveTo(75, 75, 225, 75);
ctx.quadraticCurveTo(170, 0, 150, 0);
ctx.fillStyle = "#EED3B5";
ctx.fill();
// // The second zongzi shadow
ctx.beginPath();
ctx.moveTo(150, 10);
ctx.quadraticCurveTo(25, 87, 145, 55);
ctx.quadraticCurveTo(55, 65, 200, 55);
ctx.quadraticCurveTo(170, 10, 150, 10);
ctx.fillStyle = "#FBE8D1";
ctx.fill();
// The first zongzi
ctx.beginPath();
ctx.moveTo(85, 25);
ctx.quadraticCurveTo(25, 87, 30, 100);
ctx.quadraticCurveTo(90, 100, 150, 100);
ctx.quadraticCurveTo(120, 25, 85, 25);
ctx.fillStyle = "#EED3B5";
ctx.fill();
// The first zongzi shadow
ctx.beginPath();
ctx.moveTo(85, 35);
ctx.quadraticCurveTo(25, 87, 55, 80);
ctx.quadraticCurveTo(80, 90, 130, 80);
ctx.quadraticCurveTo(120, 35, 85, 35);
ctx.fillStyle = "#FBE8D1";
ctx.fill();
// Zongzi expression
ctx.beginPath();
ctx.moveTo(107, 55);
ctx.arc(102, 55, 5, 0, Math.PI, true); // eye 1
ctx.moveTo(92, 55);
ctx.arc(87, 55, 5, 0, Math.PI, true); // eye 1
ctx.moveTo(146, 25);
ctx.arc(139, 25, 5, 0, Math.PI, true); // eye 2
ctx.moveTo(161, 25);
ctx.arc(156, 25, 5, 0, Math.PI, true); // eye 2
ctx.moveTo(100, 65);
ctx.arc(95, 65, 5, 0, Math.PI, false); // mouth ( Clockwise )
ctx.stroke();
// The second zongzi
ctx.beginPath();
ctx.moveTo(160, 45);
ctx.arc(150, 45, 10, 0, Math.PI, false); // mouth ( Clockwise )
ctx.fillStyle = "#000";
ctx.fill();
}
}
</script>
</head>
<body onload="draw();">
<canvas id="canvas" width="500" height="500"></canvas>
</body>
</html>
边栏推荐
- 数字身份验证服务商ADVANCE.AI顺利加入深跨协 推进跨境电商行业可持续性发展
- Learning C language from scratch -- installation and configuration of 01 MinGW
- MySQL environment variable configuration
- Jestson nano downloads updated kernel and DTB from TFTP server
- Development of fire power monitoring system
- Leetcode daily question (1024. video sticking)
- [CSDN]C1训练题解析_第二部分_Web基础
- Leetcode daily question (985. sum of even numbers after queries)
- How MySQL modifies null to not null
- GPIO port details, Hal library operation keys
猜你喜欢
Development of fire power monitoring system
UCI and data multiplexing are transmitted on Pusch - Part I
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
Nr-prach:prach format and time-frequency domain
Fundamentals of Electronic Technology (III)__ Logic gate symbols in Chapter 5
Solve the problem of disordered code in vscode development, output Chinese and open source code
Successful graduation [3]- blog system update...
[male nanny style] teach you to open the first wechat applet
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 2 --blinker_ Hello_ WiFi (lighting technology - Mobile App control routine)
Convert IP address to int
随机推荐
Schematic diagram and connection method of six pin self-locking switch
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 3 --blinker_ MIOT_ Light (lighting technology app control + Xiaoai classmate control)
Hudi quick experience (including detailed operation steps and screenshots)
Leetcode daily question (1856. maximum subarray min product)
Uncle Wang's blog directory [constantly updating]
PolyWorks script development learning notes (II) -treeview basic operations
顺利毕业[3]-博客系统 更新中。。。
Construction and test of TFTP server under unbuntu (Debian)
UCI and data multiplexing are transmitted on Pusch - determine the bit number of harqack, csi1 and csi2 (Part II)
Learning C language from scratch -- installation and configuration of 01 MinGW
NR technology -- MIMO
专利查询网站
[male nanny style] teach you to open the first wechat applet
Hal library sets STM32 clock
numpy. Reshape() and resize() functions
PolyWorks script development learning notes (I) - script development environment
【男保姆式】教你打开第一个微信小程序
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)
Project cost management__ Cost management technology__ Article 8 performance review
DSP data calculation error