当前位置:网站首页>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>
边栏推荐
- unbuntu(debian)下TFTP服务器搭建及测试
- STM32 interrupt priority management
- Please tell me how to set vscode
- Runtime.getRuntime().gc() 和 Runtime.getRuntime().runFinalization() 的区别
- Project cost management__ Plan value_ Earned value_ Relationship among actual cost and Countermeasures
- PolyWorks script development learning notes (4) - data import and alignment using file import
- 【男保姆式】教你打开第一个微信小程序
- Schematic diagram and connection method of six pin self-locking switch
- Nodemcu-esp8266 development board to build Arduino ide development environment
- Leetcode daily question (2109. adding spaces to a string)
猜你喜欢

Global KYC service provider advance AI in vivo detection products have passed ISO international safety certification, and the product capability has reached a new level
![Successful graduation [2] - student health management system function development...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [2] - student health management system function development...

PolyWorks script development learning notes (4) - data import and alignment using file import

MySQL data manipulation language DML common commands

Leetcode daily question (1162. as far from land as possible)

Electronic product design

PRACH --- originator

The cyclic shift of PUCCH in NR channel is generated by MATLAB

GPIO port details, Hal library operation keys
![【順利畢業】[1]-遊覽 [學生管理信息系統]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
【順利畢業】[1]-遊覽 [學生管理信息系統]
随机推荐
GPIO port details, Hal library operation keys
PIP references domestic sources
Leetcode daily question (2109. adding spaces to a string)
Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle
Call the contents of Excel cells opened at the same time - button line feed
Chromium Embedded Framework (CEF) 介绍
PIP configuring domestic sources
UCI and data multiplexing are transmitted on Pusch (Part V) -- polar coding
MySQL data manipulation language DML common commands
Arduino handles JSON data, arduinojson assistant
QT qstring:: number apply base conversion
The number of weak characters in the game (1996)
Project cost management__ Cost management technology__ Article 6 prediction
端午节快乐!—— canvas写的粽子~~~~~
The rise and fall of mobile phones in my perspective these 10 years
Design and development of biological instruments
Install local sources using yum
Leetcode daily question (968. binary tree cameras)
Flink CDC practice (including practical steps and screenshots)
Make the most basic root file system of Jetson nano and mount NFS file system on the server