Html5 canvas has a strange horizontal shape gradient (because most of the previous articles have laid the foundation, it is faster to write, if you do not understand, can review the previous one ),
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <meta http-equiv =" Content-Type "content =" text/html; charset = UTF-8 "/> <title> fill gradient shape </title> <script src =" js/modernizr. js "> </script> // Apply the horizontal gradient to the complex shape context. lineTo (0, 0); context. stroke (); context. fill ();
// Context. fill (); fill the current fillStyle into the shape context. closePath () ;}$ (document ). ready (function (e ){}); </script> <canvas id = "canvas" width = "500" height = "500"> your browser cannot use canvas kids shoes. Your support is my greatest pleasure !! </Canvas> </body>