当前位置:网站首页>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>
边栏推荐
- Implementing distributed lock with redis
- Flink learning notes (VIII) multi stream conversion
- Intelligent home design and development
- [csdn] C1 analyse des questions de formation Partie III Bar _ JS Foundation
- 文件系统中的目录与切换操作
- Leetcode daily question (2090. K radius subarray averages)
- Install local sources using yum
- Win10安装ELK
- Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 3 --blinker_ MIOT_ Light (lighting technology app control + Xiaoai classmate control)
- Qt QComboBox QSS样式设置
猜你喜欢

Project cost management__ Topic of comprehensive calculation

Intelligent home design and development

Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别

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

PolyWorks script development learning notes (I) - script development environment

Win10安装ELK

Please tell me how to set vscode
![[22 graduation season] I'm a graduate yo~](/img/e2/5393b051e2d1cb4c307efdfb3f9148.png)
[22 graduation season] I'm a graduate yo~

Nodemcu-esp8266 development board to build Arduino ide development environment
![[CSDN]C1训练题解析_第四部分_Web进阶](/img/ee/2e9756cc0e2e6eda83e1b2304c0bd6.png)
[CSDN]C1训练题解析_第四部分_Web进阶
随机推荐
Jetson nano custom boot icon kernel logo CBOOT logo
Leetcode daily question (968. binary tree cameras)
[graduation successful] [1] - tour [Student Management Information System]
Win10 install elk
Common software open source protocols
How does the nr-prach receiver detect the relationship between prembleid and Ta
PolyWorks script development learning notes (II) -treeview basic operations
Hudi quick experience (including detailed operation steps and screenshots)
UCI and data multiplexing are transmitted on Pusch - Part I
Jestson nano downloads updated kernel and DTB from TFTP server
Implementing distributed lock with redis
Chromium Embedded Framework (CEF) 介绍
Nodemcu-esp8266 development board to build Arduino ide development environment
端午节快乐!—— canvas写的粽子~~~~~
Uncle Wang's blog directory [constantly updating]
Difference of EOF
万字手撕七大排序(代码+动图演示)
PIP configuring domestic sources
PIP references domestic sources
Construction and test of TFTP server under unbuntu (Debian)