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
1. Introduction MySQL is used in the project. I i...
Table of contents 1. Array flattening (also known...
Table of contents Single content projection Multi...
1. Download, I take 8.0 as an example Download ad...
I have recently been following the CSS Animation ...
Redis uses the apline (Alps) image of Redis versi...
For security reasons, Alibaba Cloud Server ECS co...
Use native JS to write a nine-square grid to achi...
Preface We all know that in Linux, "everythi...
Use HTML to create complex tables. Complex tables...
Preface Vue provides a wealth of built-in directi...
Table of contents 1. Content Overview 2. Concepts...
1. Install the database 1) yum -y install mysql-s...
Introduction: In many cases, many people think th...
W3Cschool explains it this way The <meta> el...