HTMLAxisViewportElement <axis-viewport>
Usage:
<axis-viewport></axis-viewport> |
The <axis-viewport> HTML element is available in Axis v1.2 and above. It allows for displaying 3D content on a web page purely by using HTML, without explicit need for scripting. It can be used just as any HTML element in the web page.
As of the release date of Axis v1.2, Feb 16 2018, <axis-viewport> is supported by Chrome, Opera and Safari 10.1+. It is expected to be supported in Firefox version 60/61 and soon in Edge.
Firefox can be manually tuned to display the Axis element in versions prior to 60/61. To do that, start Firefox, go to page address about:config, find dom.webcomponents.customelements.enabled and set it to true
See a live demo on the 3D page in under 10 lines
Attributes of <axis-viewport>
- src - a string representing the 3d scene file which is to be rendered, for example src="Resources/My3DScene.axs".
It can also represent an expression that returns an AxStream object which contains a scene, for example src="getMy3DScene();". This is useful when loading s scene in a .js format, see Axis JS serialization format.
This attribute can be changed at runtime and accessed by the standard getAttribute and setAttribute of the HTML DOM or via the HTMLAxisViewportElement.src property. - oninitialize - An expression which gets evaluated once in the life time of the element, after it has initialized and ready to work.
- onload - An expression which gets evaluated each time a scene is successfully loaded by the element.
- onrender - An expression which gets evaluated each time a frame is rendered.
- scrollingenabled - A Boolean which denotes whether to allow the page scrolling and the default browser actions when user interacts with the element.
- contextmenuenabled - A Boolean which denotes whether to allow the browser's default context menu to be enabled for the element
- defaultcontrols - A Boolean which denotes whether to allow the default scene control actions from user input. Setting this attribute to true is equivalent to setting orbit, pan and zoom to true
- orbit - A Boolean which denotes whether to allow the default camera orbiting action from user input
- rotate - A Boolean which denotes whether to allow the default camera rotation action from user input
- pan - A Boolean which denotes whether to allow the default camera panning action from user input
- zoom - A Boolean which denotes whether to allow the default camera zooming action from user input