HTML5¼¼Êõ

ÍƼö8¸öʵÏÖ SVG ¶¯»­µÄ JavaScript ¿â - ÃÎÏëÌì¿Õ£¨É½±ßСϪ£©

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£º²©¿ÍÔ° 2016-05-23 14:04 ÎÒÒªÆÀÂÛ( )

SVG ÊÇÒ»ÖÖ·Ö±æÂÊÎ޹صÄͼÐΣ¨Ê¸Á¿Í¼ÐΣ©¡£ÕâÒâζ×ÅËüÔÚÈκÎÀàÐ͵ÄÆÁÄ»¶¼²»»áÔâÊÜÈκÎÖÊÁ¿Ëðʧ¡£³ý´ËÖ®Í⣬Äã¿ÉÒÔÈà SVG Áé»îÏÖһЩ¶¯»­Ð§¹û¡£ÕâƪÎÄÕ¾͸ø´ó¼ÒÍƼö8¸öʵÏÖ SVG ¶¯»­µÄ JavaScript ¿â¡£ Äú¿ÉÄܸÐÐËȤµÄÏà¹ØÎÄÕ 1. Walkway Walkwaysupports t

¡¡¡¡SVG ÊÇÒ»ÖÖ·Ö±æÂÊÎ޹صÄͼÐΣ¨Ê¸Á¿Í¼ÐΣ©¡£ÕâÒâζ×ÅËüÔÚÈκÎÀàÐ͵ÄÆÁÄ»¶¼²»»áÔâÊÜÈκÎÖÊÁ¿Ëðʧ¡£³ý´ËÖ®Í⣬Äã¿ÉÒÔÈà SVG Áé»îÏÖһЩ¶¯»­Ð§¹û¡£ÕâƪÎÄÕ¾͸ø´ó¼ÒÍƼö8¸öʵÏÖ SVG ¶¯»­µÄ JavaScript ¿â¡£

Äú¿ÉÄܸÐÐËȤµÄÏà¹ØÎÄÕÂ

 

1. Walkway

Walkway supports three type of elements, path, line, and polyline used to draw SVG lines.Here is an example from Polygon that shows the PlayStation 4 console line animation.

2. Bonsai

<ahref="https: bonsaijs.org="" "="">Bonsai is a powerful JavaScript library that allows you to draw, morph as well as animate graphical elements on web pages. It supports both HTML5 graphic type Canvas and SVG. With Bonsai, you can build a simple rectangle or a circle or if you like, a full-fledged multiplayeranimated game like this one. You can use Orbit to feel how Bonsai works in live action or check out a couple of these impressive examples to draw inspiration from.

3. Velocity

Velocity is a JavaScript library built for fast animations. Velocity’s speed when rendering animation is incredibly fast. It outperforms jQuery, and even CSS, in comparison. Velocity’s API works similar to the animation in jQuery except it uses the keyword alias $.velocity()instead of $.animate(). That aside, you can use the exact same animation keywords such asfadeIn and fadeOut.

4. Raphael

RaphaelJS is a library that allows you to draw as well as animate vector graphic SVG on web pages. It supports a wide range of browsers all the way down to IE6, which pretty much makes Raphael the most dependable JavaScript library in the niche. With RaphaelJS, you can buildinteractive analytic charts, world maps, and game interactions akin to that of Counter Strike.

5. Snap

SnapSVG is another popular JavaScript library for SVG animation developed by Raphael developer, Dmitry Baranovskiy, along with the Adobe Web Platform Team from the ground up. Unlike Raphael though, SnapSVG is meant for only the latest browsers. That allows the library to be significantly smaller than Raphael and to support SVG features like clipping and masking.

6. Lazy Line Painter

Lazy Line Painter is a jQuery plugin for animating SVG paths to animate the drawing sequence, similar to Vivus. The bad news is this plugin only does this very specific thing. Hence, when you import SVG from apps like Illustrator or Inkscape, ensure that there is no Fill color left on your SVG, just the paths.

7. SVG.Js

SVG.js is a lightweight library for manipulating and animating SVG. With this library, you’ll be able to animate the size, position or color within your SVG element. It not only animates though; you can also  to add extra functionalities. This example uses the svg.filter.js plugin to apply filters like gaussian blur, desaturate, contrast, sepia etc. to the image.

 

8. Vivus

Vivus is a JavaScript library that gives your SVG the appearance of being drawn. Vivus works out of the box without a need for any dependencies (e.g. jQuery). Simply include the .js file in your HTML, and designate the SVG element you want to animate, along with some preset options to start the animation right away.

The above will animate my SVG element that has the svg-element ID in 200 millisecond. Each element of this SVG will be drawn one after the other within that time-frame.

Äú¿ÉÄܸÐÐËȤµÄÏà¹ØÎÄÕÂ

 

±¾ÎÄÁ´½Ó£º

±àÒëÀ´Ô´£ºÃÎÏëÌì¿Õ ¡ô ¹Øעǰ¶Ë¿ª·¢¼¼Êõ ¡ô ·ÖÏíÍøÒ³Éè¼Æ×ÊÔ´

¡¡

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

Ïà¹ØÎÄÕÂ
  • HTML5 ½ø½×ϵÁУºÍÏ·Å API ʵÏÖÍÏ·ÅÅÅÐò - _ÁÖöÎ

    HTML5 ½ø½×ϵÁУºÍÏ·Å API ʵÏÖÍÏ·ÅÅÅÐò - _ÁÖöÎ

    2017-05-02 11:02

  • µ÷È¡°Ù¶ÈµØͼ½Ó¿Ú£¬ÊµÏÖÈ¡×Ô¼ºµÄʵʱλÖã¬È»ºó¿ÉÒÔÔڰٶȵØͼÉÏÌí¼ÓÐÅÏ¢±ê×¢ - QISHUANG

    µ÷È¡°Ù¶ÈµØͼ½Ó¿Ú£¬ÊµÏÖÈ¡×Ô¼ºµÄʵʱλÖã¬È»ºó¿ÉÒÔÔڰٶȵØͼÉÏÌí¼Ó

    2017-04-18 10:02

  • ¼ÆËã»úÍøÂ硪¡ªDNSЭÒéµÄѧϰÓëʵÏÖ - ѧÊýѧµÄ³ÌÐòÔ³

    ¼ÆËã»úÍøÂ硪¡ªDNSЭÒéµÄѧϰÓëʵÏÖ - ѧÊýѧµÄ³ÌÐòÔ³

    2017-04-16 10:00

  • [΢ÐŲúÆ·¾­ÀíÍƼö] ÓгµÒ»×帣Òô£¬Õâ¸öС³ÌÐòÄܹ»°ïµ½ÄãºÜ¶à棬¹¦ÄܺÜÄæÌ죡 - ÌÚѶ¹¥³Çʦlee

    [΢ÐŲúÆ·¾­ÀíÍƼö] ÓгµÒ»×帣Òô£¬Õâ¸öС³ÌÐòÄܹ»°ïµ½ÄãºÜ¶à棬¹¦

    2017-04-13 08:03

ÍøÓѵãÆÀ
³