Version 3, last updated by wycc at February 16, 2011 17:40 UTC
BrowserPortingHTML5
Application Framework
Although the application framework itself can be executed in the browser without issue, it rely on the following low level functions.
- Scene and component support. This is actually part of the SVG renderer. We will use different renderer for MB binding and browser binding. The MB binding is in svg_mb.js and the browser binding is in svg_browser.js.
- The event system. The keyboard and mouse event handler is different in the MB and the browser. However, we define the event abstraction layer for the event handling.
SVG renderer
The SVG renderer probides two functions. Firstly, it must be able to parse the meta information from the SVG, those information can be used by the scene and animation framework. Secondly, it must be able to call the low level primitives to render the SVG.
In the MB binding, we call the MB API to render the SVG and the animation is actually implemented in the javascript. The SVG parser is implemented in the svg_mb.js.
In the browser binding, we insert the SVG as part of the page and then use the SVG DOM to parser the meta information for the scene and animation. The SVG parser is implemented in the svg_browser.js
The SVG renderer provide the following external interfaces.
- Constructor: The constructor take three arguments.
- rt: The application runtime.
- root: The window which hold the SVG. It can be the full screen or a DIV of the HTML file.
- filename: The SVG filename.
- getFrameNumber: This function will return a integer frame number from a symbolic name. It takes two arguments
- component: The component which has the named frame. If it is empty string, we will use the default component.
- name: The name of frame.
- goto: This function will goto the select frames. It takes two arguments.
- compoenent: The component which has the named frame. If it is empty string, we will use the default component.
- frame: The frame number.
Animation