31
Oct 11

Developer-oriented features and experiments

Tilt is a Firefox addon that lets you visualize any web page in 3D. A new update is available, coming with more developer-oriented features. Try the addon.

Since the first alpha version of Tilt was announced (a Firefox extension focused on creating a 3D visualization of a webpage), a lot of work has been done to add a great number of developer-oriented features. These focus on debugging the structure of a webpage, inspecting styling and attributes for each node and seamlessly refreshing the visualization when the DOM structure changes or after contents of document are repainted.

Solve nesting problems

Tilt is useful when searching problems in the HTML structure (like finding unclosed DIV elements for example) by providing the extra third dimension, layering each node based on nesting in the DOM tree. Stacks of elements visually represent branches in the DOM, and each node can be inspected for the inner HTML contents, its computed CSS style and the attributes.

Clicking anywhere on the visualization highlights a color-coded rectangle surrounding the corresponding node. Double click shows up the source preview for that node. Tilt also tries to show the most relevant information when needed (one is most likely to inspect the attributes of an input, button or image element, for example, but can easily switch between HTML, CSS and attributes view at any time).

Minidom map

The “minidom” is a tree view representation showing a minimalistic snapshot of the document object model. Each node is assigned a color associated by tag name (blue for div, green for span etc.) and represented as a strip, along with visual markers for the id and/or class if available. Each one of these strips also has a width relative to the type, id and class name length for the respective element, and the corresponding 3D stack in the visualization has color-coded margins. The coloring for individual elements is easily changeable using the color picker near to the minidom legend.

Clicking a strip in the tree view (or directly a stack on the 3D document visualization mesh) also highlights the node with a colored quad. This behavior is a good way to relate with the Style Inspector, and a more unified interaction between Tilt and other Developer Tools is planned in the future. All of these additions make it easier to analyze the bounds of each node, along with the HTML, computed CSS and attributes.

Realtime editing

Because Tilt is able to detect when a webpage’s DOM structure changes or when a repaint is necessary, integration is seamless with existing Developer Tools. Using Tilt and Firebug or Style Editor at the same time is easy. One can enable or disable CSS properties, changing the style of a node, and the visualization changes accordingly.

To enable realtime updates for the 3D webpage, go to the Options menu and check “Refresh visualization”.

Useful for learning

Developer tools such as “view source” have always been used to help people learn about web development. The 3D view highlights the structure of a page better than a flat view, thus anyone can immediately understand the parent-child relationship between nodes in a webpage, their positioning and how the layout is influenced.

One use case for this is the Hackasaurus mashup. The X-Ray Goggles is a nice and fun tool designed to make it easier to learn about the different document node types, the “building blocks” which create a webpage.

Export

A requested feature was the ability to export the visualization as a 3D mesh, to be used in games or other 3D editors. Tilt adds the ability to export to .obj, along with a material .mtl file and a .png texture (a screenshot of the entire webpage). The open .obj format ensures the fact that the mesh can be opened with almost any editor. Here’s a ray-traced rendering of hacks.mozilla.org in Blender:

Fun with experiments

As soon as it was released, many people found clever and interesting alternative ways to interact with Tilt. One experiment was creating a 3D visualization of an image, by exporting chunks of pixels to a HTML representation. The result was a voxel-like representation, with node blocks and stacks instead of pixels. A simple Image2Tilt converter was written in JavaScript, and you can try it directly in the browser.

Accelerometer support was another addition based on community request. This shows how easy it is to add functionality that wasn’t originally planned.

You can view the source code, fork it and also contribute to the addon with ideas or feature requests on Github, at github.com/victorporof/Tilt.

Available as an addon

The latest version of Tilt can be found on Github, but you can also download Tilt as an addon from addons.mozilla.org.

For compatibility, Tilt requires WebGL capabilities. Go to get.webgl.org to check availability and troubleshoot any issues. The current version works with Firefox 6.0 to latest 10.0 Nightly releases (latest Nightly builds now also support WebGL anti-aliasing, working great with Tilt).

To start Tilt, hit Control+Shift+M (or Command+Shift+M if you’re on Mac OS), or go to Web Developer -> Tilt, available in the Firefox application menu (or the Tools menu on Mac OS). You can modify this hotkey (and other properties) from the Options menu after starting Tilt.

More information about Tilt, the development process and milestone updates can be found on blog.mozilla.org/tilt.

Future

Tilt has become an active Developer Tools project, and an ongoing effort is made to integrate it with other existing tools like Style Inspector and Style Editor (source code and latest builds). As the 3D view of a webpage has proven to be useful for debugging, this main functionality will gradually become part of Firefox in future releases.


01
Sep 11

Version 0.82 released

Download: Tilt.xpi
August was a busy month. Tilt development was focused on finishing the user interface and adding an improved user experience. We also added more developer-oriented features and functionality.

The most interesting addition was the “minidom” — a tree view representation in the lower left, showing a minimalistic snapshot of the document object model of a webpage. Each node is assigned a color associated by tag name (blue for div, green for span etc.) and represented as a strip, along with visual markers for it’s id and/or class if available. Each one of these strips also has a width relative to the type, id and class name length for the respective element. The coloring for individual elements is easily changeable using a color picker.

Clicking a strip in the tree view (or directly a node on the 3D document visualization mesh) now also highlights the node with a colored quad. This behavior is a good way to relate with the Style Inspector, and a more unified interaction between them is planned in the future (along with other developer tools like Style Editor).

All of these additions make it easier to analyze the bounds of each node, along with the html, computed css and attributes (which are available in the popup panel editor).

A requested feature was the ability to export the visualization as a 3D mesh, to be used in games or other 3D editors. In version 0.82, Tilt adds the ability to export to .obj, along with a material .mtl file and a .png texture. The .obj open format ensures the fact that the mesh can be opened with almost any editor, from Blender to Maya. Here’s a ray-traced rendering of hacks.mozilla.org in Blender:

The exported .png can also be used to create full screenshots of webpages, as it saves the visible part of a document along with it’s “offscreen” elements.

The three months dedicated to developing Tilt in the Google Summer of Code timeframe have finished, but that doesn’t mean an ending for improving this extension. It’s worth mentioning that version 0.82 of Tilt is now waiting approval to be public in addons.mozilla.org and a great thing to know that, already, even though Tilt isn’t public yet, there are already over 8,000 users.

Implementing more and more features is a sure thing in the near future. The nearest milestone (0.9) will add enhancements like: highlighting and scrolling a selected element in the “minidom”, making a selected strip center/zoom the node stack in the visualization, adding controls to move up/down the dom tree in the editor panel popup, and adding more functionality for the user interface. See all the TODOs and the planned features for more details. You can try some of these additions in the beta from the r90 branch on github.