×Öööð ×öö§ § {{µä{μ Ö ö¡ html5 {µà ý ¿, html5.
Ó Ã html5 µ μ Ï ööçí ¼ ×ööð Ó Ð ×öð § ¹ û
Ê μ Ï ö~~â · £° Ó ?canvas =äö~äzö£;è» °ó ö~ö~ö{n {?? please refer to the zookeeper without any help.
° Ë Ð äúâ ë £°
JavaScript Code comment:
- Var canvas;
- Var ctx;
- Var tex;
- Var blankStr = ""; // ä ämöö ° ×
- $ (Function (){
- $ ("Button # bt"). click (function () {// ° ó ¨ ° '000000000000¥» 00000000â 000000000000'
- If ($ ("canvas # myCanvas"). length> 0 ){
- Canvas = $ ("canvas # myCanvas") [0];
- Ctx = canvas. getContext ("2d ");
- }
- Var tex = $ ("input # inpt"). val (); //» n'~~~~~~~ä×ö
- If (! Tex) tex = "Yellow ¥"; // ä~~~~~ä×ö~~" yellow ¥"
- If (tex. length> 1) {// öö§ ³ öò» Ö ö° ×ö
- Alert ("ç×£ ~ ");
- Return;
- }
- Var reg =/[\ u4E00-\ u9FA5]/g; // Ó ý Ô ò ± ±í' ï Ê ½ Å Ð Ç ñ?
- If (! Reg. test (tex )){
- Alert ("ç×£ ;************************************************************* Ø ~ ");
- Return;
- }
- Ctx. fillStyle = "rgba (0, 0, 0, 1)"; //» Ö öæ µé «
- Ctx. fillRect (20, 20, 40, 40 );
- ?
- Ctx. fillStyle = "rgba (255,255,255, 1)" //» Ö ö~~ä×ö
- Ctx. font = "bolder 40px too many bytes ";
- Ctx. textBaseline = 'top ';
- Ctx. fillText (tex, 20, 20 );
- Var panel = $ ("# panel"); // ° × öê ä~öçororó ò
- Panel.html ("");
- For (y = 1; y <40; y ++ ){
- For (x = 1; x <40; x ++ ){
- ImageData = ctx. getImageData
- If (imageData. data [0]> 180) {// 0 Î ° ú£° ° £ 255 Î ° × £ ******************************************* (2)» í¬ ä¯ À ¶ ä Ä äüámámám?° ° § ¹ û
- Panel.html(panel.html () + blankStr );
- } Else {
- Panel.html(panel.html () + tex );
- }
- }
- Panel.html(panel.html () + "<br> ");
- }
- });
- $ ("Button # bt"). click (); // µúram» '{ó Ó Ø Ç äö ö" {¥"
- });
*************************************************************** À öguímímámímímámāzärämámámímímámímāmāmāmāmāmāmāmāmāmāmāmāmla. ö² zookeeper £;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ô Î äµöö· £° http: // www.cnblogs.com/shouce/archive/2016/05/03/5453737.html