Use canvas to create graphics and text with shadows for your reference. The specific contents are as follows ctx.shadowBlur=20; Set the shadow blur range. You can also use The shadowOffsetX property sets the horizontal distance between the shadow and the graphic. Code: <!DOCTYPE html> <html> <head> <title>Creating graphics and text with shadows</title> </head> <body> <h3 align="center">Radial gradient color</h3> <hr> <canvas id="myc1" width="800" height="600"></canvas> <script type="text/javascript"> var myc = document.getElementById("myc1"); //Draw a new canvas var ctx = myc.getContext("2d"); //Set the drawing environment to 2d var myg = ctx.createRadialGradient(130,200,0,130,200,90); //addColorStop method first parameter is the percentage in the image and second parameter is the color myg.addColorStop(0,"white"); myg.addColorStop(0.5,"pink"); myg.addColorStop(0.6,"green"); myg.addColorStop(0.4,"blue"); ctx.fillStyle=myg; ctx.shadowColor="black"; //Shadow color ctx.shadowBlur=20; //Shadow blur range ctx.arc(130,200,100,0,Math.PI*2); //Draw a new circle ctx.fill(); ctx.beginPath(); var myg1 = ctx.createRadialGradient(550,250,50,550,250,200); myg1.addColorStop(0,"blue"); myg1.addColorStop(0.6,"green"); myg1.addColorStop(1,"red"); ctx.fillStyle=myg1; ctx.font="50px bold"; //Set font size and font style ctx.shadowBlur=50; //Set shadow blur range ctx.shadowColor="yellow"; //Shadow color; ctx.shadowOffsetX=30; //Horizontal online offset; ctx.shadowOffsetY=-30; //Vertical offset downward; ctx.fillText("Radioactive gradient text",350,200); </script> </body> </html> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: View MySQL installation information under Linux server
>>: Nginx uses Lua+Redis to dynamically block IP
Overview As for the current default network of Do...
Absolute, relative and fixed in position position...
1. Rendering 2. Source code HTML < body > &...
Preface Today I will share with you a holy grail ...
css-vars-ponyfill When using CSS variables to ach...
This article uses examples to illustrate the usag...
Preface: In MySQL, views are probably one of the ...
Preface: MySQL is a relational database managemen...
Recently, when I was modifying the intranet porta...
Table of contents 1. Project Construction 2. Vue3...
UCenter Home is an SNS website building system rel...
Generally, after there is a menu on the left, the...
1. Download Navicat for MySQL 15 https://www.navi...
1. Single column index Choosing which columns to ...
Table of contents 1. VueRouter 1. Description 2. ...