当前位置:网站首页>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>
边栏推荐
- What do software test engineers do? Pass the technology to test whether there are loopholes in the software program
- 顺利毕业[2]-学生健康管理系统 功能开发中。。。
- [CSDN]C1训练题解析_第二部分_Web基础
- Getting started with shell programming
- numpy. Reshape() and resize() functions
- Electronic product design
- 基于opencv实现桌面图标识别
- [male nanny style] teach you to open the first wechat applet
- Nr-prach:prach format and time-frequency domain
- The cyclic shift of PUCCH in NR channel is generated by MATLAB
猜你喜欢

Project cost management__ Topic of comprehensive calculation
![【顺利毕业】[1]-游览 [学生管理信息系统]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
【顺利毕业】[1]-游览 [学生管理信息系统]

MySQL data manipulation language DML common commands
![[male nanny style] teach you to open the first wechat applet](/img/a1/a571609ee846adf75506a88a629906.png)
[male nanny style] teach you to open the first wechat applet

Convert IP address to int

Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)

Nr-prach:prach format and time-frequency domain

Fundamentals of Electronic Technology (III)__ Chapter 1 resistance of parallel circuit

Nr-prach: access scenario and access process

Please tell me how to set vscode
随机推荐
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)
Win10 install elk
[CSDN]C1训练题解析_第三部分_JS基础
How does the nr-prach receiver detect the relationship between prembleid and Ta
Flink learning notes (XI) table API and SQL
【男保姆式】教你打开第一个微信小程序
PolyWorks script development learning notes (III) -treeview advanced operation
解决Editor.md上传图片获取不到图片地址问题
Difference of EOF
Implementing distributed lock with redis
Solve the problem of disordered code in vscode development, output Chinese and open source code
Epollet lessons
MySQL data manipulation language DML common commands
[22 graduation season] I'm a graduate yo~
1922. Count Good Numbers
Arduino handles JSON data, arduinojson assistant
[combinatorics] Introduction to Combinatorics (context of combinatorics | skills of combinatorics | thought of combinatorics 1: one-to-one correspondence)
QT qstring:: number apply base conversion
[CSDN]C1訓練題解析_第三部分_JS基礎
Electronic product design