当前位置:网站首页>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>
边栏推荐
- Leetcode daily question (2212. maximum points in an archery competition)
- QT sub window is blocked, and the main window cannot be clicked after the sub window pops up
- Raspberry pie installation SciPy
- 顺利毕业[2]-学生健康管理系统 功能开发中。。。
- 解决Editor.md上传图片获取不到图片地址问题
- Hudi data management and storage overview
- Error output redirection
- Nr-prach: access scenario and access process
- Construction and test of TFTP server under unbuntu (Debian)
- Leetcode daily question (968. binary tree cameras)
猜你喜欢

Fundamentals of Electronic Technology (III)_ Integrated operational amplifier and its application__ Basic arithmetic circuit
![[CSDN] C1 training problem analysis_ Part II_ Web Foundation](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN] C1 training problem analysis_ Part II_ Web Foundation

Flink learning notes (XI) table API and SQL

Hal library sets STM32 clock

MySQL Data Definition Language DDL common commands

Eight working modes of stm32gpio and chip naming rules

小王叔叔的博客目录【持续更新中】

Learning C language from scratch -- installation and configuration of 01 MinGW

Vscode Arduino installation Library
![Uncle Wang's blog directory [constantly updating]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Uncle Wang's blog directory [constantly updating]
随机推荐
Jetson nano custom boot icon kernel logo CBOOT logo
Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 2 --blinker_ Hello_ WiFi (lighting technology - Mobile App control routine)
Failed building wheel for argon2 cffi when installing Jupiter
How MySQL modifies null to not null
Flink learning notes (XI) table API and SQL
Leetcode daily question (985. sum of even numbers after queries)
2021-09-26
Intelligent home design and development
【力扣刷题笔记(二)】特别技巧,模块突破,45道经典题目分类总结,在不断巩固中精进
Directory and switching operation in file system
【22毕业季】我是毕业生yo~
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 4 --blinker_ DHT_ WiFi (lighting technology app control + temperature and humidity data app display)
软件测试工程师是做什么的 通过技术测试软件程序中是否有漏洞
Vscode Arduino installation Library
Leetcode daily question (2090. K radius subarray averages)
Vector processor 9_ Basic multilevel interconnection network
基于opencv实现桌面图标识别
Flink learning notes (10) Flink fault tolerance mechanism
Long类型的相等判断