当前位置:网站首页>Wechat applet canvas draws a simple asymptotic color of the dashboard
Wechat applet canvas draws a simple asymptotic color of the dashboard
2022-04-23 03:32:00 【I can fix software】
wxml <canvas type="2d" id="myCanvas" class="secondView" > </canvas>
js part
drawCanvas: function (canvasWidth,canvasHigth){
wx.createSelectorQuery().select('#myCanvas').fields({ node: true, size: true }).exec(res => {
const canvas = res[0].node;
const ctx = canvas.getContext('2d');
canvas.width=canvasWidth;
canvas.height=canvasHigth;
let cicleCenterX=canvasWidth/2;
let cicleCenterY=canvasHigth*11/20;
// Draw background chassis
ctx.beginPath();
ctx.arc(cicleCenterX, cicleCenterY, 90, 0.8* Math.PI, 2.2* Math.PI)
ctx.strokeStyle = '#ffa600';
ctx.lineWidth = 4;
ctx.setLineDash([0]);
ctx.stroke();
ctx.fillStyle='#3366ff';
ctx.textAlign='center';
ctx.font='normal normal 16px Microsoft YaHei ';
ctx.fillText(' Issued ', cicleCenterX, cicleCenterY*3/4);
ctx.font='normal blod 22px Microsoft YaHei ';
ctx.fillText('88,888 element ', cicleCenterX, cicleCenterY);
ctx.fillStyle='#e35702';
ctx.font='normal normal 16px Microsoft YaHei ';
ctx.fillText(' Total bonus :1,000,000 element ', cicleCenterX, cicleCenterY*5/4);
ctx.fillStyle='#e35702';
ctx.font='normal normal 14px Microsoft YaHei ';
ctx.fillText(' Handle the business , You can get 10 element ', cicleCenterX, canvasHigth-5);
ctx.font='normal normal 16px Microsoft YaHei ';
ctx.fillText(' Rush progress ', 50,30);
// Draw the fill color section
ctx.beginPath();
ctx.rect(5, 10, 5, 25);
ctx.fillStyle='#ffa600';
ctx.fill();
// Draw the fill color section
ctx.beginPath();
const grd = ctx.createLinearGradient(0, 0, 200, 0)
grd.addColorStop(0, '#ffa600')
grd.addColorStop(1, 'red')
ctx.arc(cicleCenterX, cicleCenterY, 90, 0.8* Math.PI, 1.6* Math.PI);
ctx.strokeStyle = grd;
ctx.lineWidth = 5;
ctx.setLineDash([0]);
ctx.stroke();
});
}
effect :

版权声明
本文为[I can fix software]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220607290981.html
边栏推荐
- Node configuration environment CMD does not take effect
- Initial experience of talent plan learning camp: communication + adhering to the only way to learn open source collaborative courses
- Chapter 8 exception handling, string handling and file operation
- Section 1 array and slicing in Chapter 6
- AWS from entry to actual combat: creating accounts
- JS changes the words separated by dashes into camel style
- C-11 problem h: treasure chest 2
- Basic use of Charles
- Redis (17) -- redis cache related problem solving
- Codeforces Round #784 (Div. 4)题解 (第一次AK cf (XD
猜你喜欢

File upload vulnerability summary and upload labs shooting range documentary

【微服务】(十)—— 统一网关Gateway

Design and implementation of redis (4): what is the event driver of redis

Flink customizes the application of sink side sinkfunction

Codeforces round 784 (Div. 4) (AK CF (XD) for the first time)

Applet - WXS

The art of concurrent programming (2): synchronized usage scenarios

The art of concurrent programming (3): an in-depth understanding of the principle of synchronized

全新的ORM框架——BeetlSQL介绍

Quartz. Www. 18fu Used in net core
随机推荐
Optimization of especially slow startup in idea debugging mode
POI create and export Excel based on data
L3-011 直捣黄龙 (30 分)
New ORM framework -- Introduction to beetlsql
Applet - canvas drawing Poster
7-1 introduction to finance
Application and definition of interface
Téléchargement en vrac de fichiers - téléchargement après compression
Several common methods of multithreading
Create virtual machine
移植tslib时ts_setup: No such file or directory、ts_open: No such file or director
Redis (17) -- redis cache related problem solving
第四次作业
Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
Definition format of array
Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800
Supersocket is Used in net5 - command
Design and implementation of redis (2): how to handle expired keys
场景题:A系统如何使用B系统的页面
Download and configuration of idea