×Öööð ×öö§ § {{µä{μ Ö ö¡ html5 {µà ý ¿, html5.

Source: Internet
Author: User

×Öööð ×öö§ § {{µä{μ Ö ö¡ html5 {µà ý ¿, html5.

Ó Ã html5 µ μ Ï ööçí ¼ ×ööð Ó Ð ×öð § ¹ û

Ê μ Ï ö~~â · £° Ó ?canvas =äö~äzö£;è» °ó ö~ö~ö{n {?? please refer to the zookeeper without any help.

° Ë Ð äúâ ë £°

JavaScript Code comment:
  1. Var canvas;
  2. Var ctx;
  3. Var tex;
  4. Var blankStr = ""; // ä ämöö ° ×
  5. $ (Function (){
  6. $ ("Button # bt"). click (function () {// ° ó ¨ ° '000000000000¥» 00000000â 000000000000'
  7. If ($ ("canvas # myCanvas"). length> 0 ){
  8. Canvas = $ ("canvas # myCanvas") [0];
  9. Ctx = canvas. getContext ("2d ");
  10. }
  11. Var tex = $ ("input # inpt"). val (); //» n'~~~~~~~ä×ö
  12. If (! Tex) tex = "Yellow ¥"; // ä~~~~~ä×ö~~" yellow ¥"
  13. If (tex. length> 1) {// öö§ ³ öò» Ö ö° ×ö
  14. Alert ("ç×£ ~ ");
  15. Return;
  16. }
  17. Var reg =/[\ u4E00-\ u9FA5]/g; // Ó ý Ô ò ± ±í' ï Ê ½ Å Ð Ç ñ?
  18. If (! Reg. test (tex )){
  19. Alert ("ç×£ ;************************************************************* Ø ~ ");
  20. Return;
  21. }
  22. Ctx. fillStyle = "rgba (0, 0, 0, 1)"; //» Ö öæ µé «
  23. Ctx. fillRect (20, 20, 40, 40 );
  24. ?
  25. Ctx. fillStyle = "rgba (255,255,255, 1)" //» Ö ö~~ä×ö
  26. Ctx. font = "bolder 40px too many bytes ";
  27. Ctx. textBaseline = 'top ';
  28. Ctx. fillText (tex, 20, 20 );
  29. Var panel = $ ("# panel"); // ° × öê ä~öçororó ò
  30. Panel.html ("");
  31. For (y = 1; y <40; y ++ ){
  32. For (x = 1; x <40; x ++ ){
  33. ImageData = ctx. getImageData
  34. If (imageData. data [0]> 180) {// 0 Î ° ú£° ° £ 255 Î ° × £ ******************************************* (2)» í¬ ä¯ À ¶ ä Ä äüámámám?° ° § ¹ û
  35. Panel.html(panel.html () + blankStr );
  36. } Else {
  37. Panel.html(panel.html () + tex );
  38. }
  39. }
  40. Panel.html(panel.html () + "<br> ");
  41. }
  42. });
  43. $ ("Button # bt"). click (); // µúram» '{ó Ó Ø Ç äö ö" {¥"
  44. });

*************************************************************** À ö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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.