当前位置:网站首页>The first lesson is canvas, showing a small case
The first lesson is canvas, showing a small case
2022-04-23 13:05:00 【It's never too late to be alone】
There's not much work today , I have time to learn about canvas, By the way, I drew a “ Ding ” old man , It is hereby displayed , Just waiting for the public to have fun !

It's not good ????
Forget it , Hot eyes are hot eyes , Look at the code .
<canvas id="canvas" width="500" height="500"></canvas>
var canvas = document.getElementById("canvas");
var context = canvas.getContext('2d');
// First draw a head
context.beginPath();
context.arc(250,250,50,0,Math.PI*2);
context.stroke();
// Draw two more ears
context.beginPath();
context.arc(200,200,20,0,Math.PI*2);
context.fill();
context.beginPath();
context.arc(300,200,20,0,Math.PI*2);
context.fill();
// Draw two more eyes
context.beginPath();
context.arc(230,240,10,0,Math.PI*2);
context.stroke();
context.beginPath();
context.arc(270,240,10,0,Math.PI*2);
context.stroke();
// Mend two eyes
context.beginPath();
context.arc(230,240,2,0,Math.PI*2);
context.fill();
context.beginPath();
context.arc(270,240,2,0,Math.PI*2);
context.fill();
// Draw another triangular nose
context.beginPath();
context.moveTo(250,250);// Point a point in the canvas , Don't create lines
context.lineTo(240,260);// Add a new point , Then create a line from this point to the last specified point in the canvas ( This method does not create lines )
context.lineTo(260,260);// Add a new point , Then create a line from this point to the last specified point in the canvas ( This method does not create lines )
context.closePath();// The end point returns to the starting point
context.stroke();
// Draw another mouth
context.beginPath();
context.arc(250,270,15,0,Math.PI,false);
context.stroke();
Look at this ,canvas It's still fun
版权声明
本文为[It's never too late to be alone]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231303466040.html
边栏推荐
- Recovering data with MySQL binlog
- Record some NPM related problems (messy records)
- Pytorch: a pit about the implementation of gradreverselayer
- SSM framework series - data source configuration day2-1
- About the 'enum' enumeration type and structure.
- V-model binding value in El select, data echo only displays value, not label
- Proteus 8.10 installation problem (personal test is stable and does not flash back!)
- Design of body fat detection system based on 51 single chip microcomputer (51 + OLED + hx711 + US100)
- mysql8安装
- Get the punch in record of nailing attendance machine
猜你喜欢

1130 - host XXX is not allowed to connect to this MySQL server error in Navicat remote connection database
![[51 single chip microcomputer traffic light simulation]](/img/70/0d78e38c49ce048b179a85312d063f.png)
[51 single chip microcomputer traffic light simulation]

22. 括号生成

Record Alibaba cloud server mining program processing

拥抱机器视觉新蓝海,冀为好望开启数字经济发展新“冀”遇

100 GIS practical application cases (53) - making three-dimensional image map as the base map of urban spatial pattern analysis

Jupiter notebook installation

Summary of JVM knowledge points - continuously updated

The quill editor image zooms, multiple rich text boxes are used on one page, and the quill editor upload image address is the server address

Pytorch: a pit about the implementation of gradreverselayer
随机推荐
4.22 study record (you only did water problems in one day, didn't you)
100 GIS practical application cases (51) - a method for calculating the hourly spatial average of NC files according to the specified range in ArcGIS
[51 single chip microcomputer traffic light simulation]
About the 'enum' enumeration type and structure.
AUTOSAR from introduction to mastery 100 lectures (83) - bootloader self refresh
8 websites that should be known for product development to enhance work experience
CGC: contractual graph clustering for community detection and tracking
Recovering data with MySQL binlog
21 days learning mongodb notes
Hanlp word splitter (via spark)
Design and manufacture of 51 single chip microcomputer solar charging treasure with low voltage alarm (complete code data)
Unable to create servlet under SRC subfile of idea
CVPR 2022&NTIRE 2022|首个用于高光谱图像重建的 Transformer
decast id.var measure. Var data splitting and merging
mui picker和下拉刷新冲突问题
Golang implements MD5, sha256 and bcrypt encryption
98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
Custom nail robot alarm
100 GIS practical application cases (53) - making three-dimensional image map as the base map of urban spatial pattern analysis
100 lectures on practical application cases of Excel (VIII) - report connection function of Excel