What else does HTML5 need to overcome Flash?

Source: Internet
Author: User

HTML5 and Flash are functionally not completely overlapping, such as the camera and other computer hardware calls, still can only use Flash or other methods to achieve. But HTML5 has introduced some elements that Flash has to take seriously. The most known and most important of these are the canvas and video tags. In my opinion, the other new properties and flash competitive relationship is very weak, only the two are really going to grab the job of flash, and once popularized, will profoundly change the entire Internet, is HTML5 's right-arm.

Before Flash was popular, there were a number of ways to implement drawing capabilities in Web pages, including the famous Java applets. These methods have their own advantages and are competitive with each other. But after the Macromedia company launched Flash, the war soon ended.

In order to fight Flash, there are a lot of new technologies are proposed, including now Flash's owner Adobe proposed SVG. However, this does not prevent Flash to be quickly accepted by netizens. Flash-based animations, games and other applications almost overnight spread to every corner of the Internet.

Now, the new challenger emerges, and he is HTML5 's new label canvas.

Canvas obviously has its advantages over Flash. It does not depend on external plugins, tightly combined with the browser rendering engine, saves resources, and most importantly simplifies the interaction of graphics and other elements of the Web page.

For Flash, it takes a lot of time and resources to make the elements in flash interact with other elements in the web, and it's also quite inconvenient in programming.

The canvas itself is an element of HTML5, and it can be manipulated like ordinary HTML elements. Developers can write all the code neatly in a file, reducing the difficulty of maintenance and updating.

However, Canvas also has its drawbacks:

One is that developers have to program each point and vector curve, and they need to deal with matrix transformations when rotating and zooming, which can increase the difficulty of drawing complex graphics. In Flash, the graphical display of the API is encapsulated in a class called "Sprite (Display list)", most of the graphic elements are inherited from this class, developers can use a variety of tools to design graphics, rotation and scaling of the graphics simply need to simply call the function of the class.

Secondly, the implementation of animation is flawed. Although canvas provides a different approach to animating with div blocks than traditional, this approach is still cumbersome. Developers must empty the canvas when each frame is displayed, and then redraw all the elements, which inevitably results in a slow animation of the scene with a large number of elements, and a lot of resources will be wasted by moving only a few elements to redraw the canvas. and creating animations is also a very tedious task. In contrast, the implementation of Flash is much more convenient, although from the bottom, the animation still needs to redraw the entire canvas, but it is delivered to flash Player Automatic processing, without the developer manual management. BYTE-code-based Flash will be faster in parsing than HTML5 and JavaScript, which are instantly compiled. In general, complex animations will be smoother. In addition, the well-packaged graphics class and powerful design tools make it easy to create animations.

Thirdly, it does not provide a set of convenient event system. The developer may want to determine what graphic elements the user clicked by capturing the coordinates that the mouse clicked in the canvas. In this process, it is possible to traverse all the display elements and determine whether the point is within the graph, which is cumbersome to implement, not to mention the bubbling and recursive model of the event. While future graphics libraries can solve this problem, this is essentially equivalent to building a set of incident response models using JavaScript, which is obviously less efficient than the native event model built into the browser. In Flash, events are also well encapsulated as classes, capturing clicks and other events naturally, and more importantly, providing events and functions that determine whether two graphs intersect, which is very handy in game programming. In addition, the latest version of Flash will support the response of multi-touch events, and the HTML would like to support this I am afraid to wait until HTML6.

What else does HTML5 need to overcome Flash?

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.