HTML5¼¼Êõ

canvas»æ»­»ù´¡(Ò»)£ºÈÏʶcanvas»­²¼ - yangtoude

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-07-01 15:02 ÎÒÒªÆÀÂÛ( )

html5ÌṩÁËÒ»¸öcanvas±êÇ©£¬½áºÏjavascriptµÄcanvas api½Ó¿Ú¿ÉÒÔÓÃÀ´»æÖÆͼÐκͶ¯»­¡£×î½ü¹¤×÷ÖÐÉæ¼°µ½»­Í¼µÄÈÎÎñ£¬ÏÂÃæÀ´Á˽âÒ»ÏÂcanvasµÄ»ù´¡£ºcanvas»­²¼¡£ 1£¬canvas£¨»­²¼£©µÄwidthºÍheight ÉÏÃæµÄ´úÂëÖзÅÖÃÁËÁ½¸öcanvas»­²¼£¬Ò»¸±Í¼Æ¬£¬¿ÉÒÔ¿´µ½canv

html5ÌṩÁËÒ»¸ö<canvas>±êÇ©£¬½áºÏjavascriptµÄcanvas api½Ó¿Ú¿ÉÒÔÓÃÀ´»æÖÆͼÐκͶ¯»­¡£×î½ü¹¤×÷ÖÐÉæ¼°µ½»­Í¼µÄÈÎÎñ£¬ÏÂÃæÀ´Á˽âÒ»ÏÂcanvasµÄ»ù´¡£ºcanvas»­²¼¡£

1£¬canvas£¨»­²¼£©µÄwidthºÍheight

ÉÏÃæµÄ´úÂëÖзÅÖÃÁËÁ½¸öcanvas»­²¼£¬Ò»¸±Í¼Æ¬£¬¿ÉÒÔ¿´µ½canvas±êÇ©ºÍimg±êÇ©Ò»Ñù¶¼ÊÇÄÚÁªÔªËØ£¬canvasÒ²ÓÐwidthºÍheightÊôÐÔ£¬¿ÉÒÔÖ¸¶¨ËüµÄ¿í¸ß£¬Èç¹û²»Ö¸¶¨Ä¬ÈÏΪ300x150¡£

ÕâÀïÐèҪעÒâµÄÊÇ£¬Èç¹ûÓÃcssÑùʽÀ´Ö¸¶¨canvas±êÇ©µÄ¿í¸ß£¬ÄÇôcanvas»­²¼ÖеÄͼÐÎÔÚäÖȾʱ½øÐÐÏàÓ¦µÄËõ·Å£¨±äÐΣ©ÒÔÊÊÓ¦±êÇ©µÄ¿í¸ß£¬ËùÒÔ²»ÒªÓÃcssÑùʽÀ´Ö¸¶¨»­²¼µÄ¿í¸ß£¬¶øÊÇÏÔʾµÄͨ¹ýÉèÖÃcanvasµÄwidthºÍheightÀ´Ö¸¶¨»­²¼µÄ¿í¸ß¡£

 2£¬»­²¼Õ¤¸ñºÍ×ø±ê¿Õ¼ä

canvasĬÈϱ»Õ¤¸ñ£¨Íø¸ñ£©¸²¸Ç£¬Ò»°ãÀ´Ëµ£¨»­²¼Ã»Óб»Ñ¹Ëõ»òÀ­É죩һ¸öÍø¸ñ´ú±ícanvasÖеÄÒ»¸öÏñËØ¡£¶þάµÄcanvas»­²¼ÓÐÒ»¸öÔ­µã£¬Ä¬ÈϵÄλÖÃλÓÚ»­²¼µÄ×óÉϽǣº

ÕâºÍÊýѧÖг£ÓõÄÖ±½Ç×ø±êϵÂÔÓв»Í¬£¬ËüµÄyÖáÕý·½ÏòÊdz¯Ïµģ¬ÕâͬʱҲӰÏìÁË»­²¼ÖÐÏóÏ޽ǵķֲ¼£¬30¶ÈλÓÚxÖáµÄÏ·½¶ø²»ÊÇÉÏ·½£¬ÔÚ»­Í¼Ê±ÐèҪעÒâ¡£²»¹ýcanvas»­²¼ÊÇ¿ÉÒÔÐýתµÄ£¬¶øÇÒÔ­µãÒ²ÊÇ¿ÉÒÔÒƶ¯µÄ¡£

²Î¿¼£º

Canvas½Ì³Ì

<canvas>±êÇ©

 

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • HTML5 canvasѧϰСÀý´úÂë - ·çÓêºó¼û²Êºç

    HTML5 canvasѧϰСÀý´úÂë - ·çÓêºó¼û²Êºç

    2017-07-01 08:01

  • canvasºÏ³Éº£±¨ËùÓöÎÊÌâ¼°½â¾ö·½°¸×ܽá - ¾²ÐÄÂýÅÜ

    canvasºÏ³Éº£±¨ËùÓöÎÊÌâ¼°½â¾ö·½°¸×ܽá - ¾²ÐÄÂýÅÜ

    2017-06-29 17:00

  • C#¿ª·¢Òƶ¯Ó¦ÓÃϵÁÐ(3.ʹÓÃÕÕÏà»úɨÃè¶þάÂë+¸÷ÖÖ»ù´¡ÖªÊ¶) - GuZhenYin

    C#¿ª·¢Òƶ¯Ó¦ÓÃϵÁÐ(3.ʹÓÃÕÕÏà»úɨÃè¶þάÂë+¸÷ÖÖ»ù´¡ÖªÊ¶) - GuZhen

    2017-06-24 17:01

  • ¸ßµÂµØͼºÍcanvas»­Í¼½áºÏÓ¦ÓõÄһЩ¸ÐÏë(Ò») - sky2008wj

    ¸ßµÂµØͼºÍcanvas»­Í¼½áºÏÓ¦ÓõÄһЩ¸ÐÏë(Ò») - sky2008wj

    2017-06-24 14:04

ÍøÓѵãÆÀ