For my second Design Challenge tutorial session, I did a presentation on how to make interactive prototypes with Canvas. After all, not every prototype needs to be done as a Firefox extension. Canvas prototypes are far quicker and easier to make, and although more limited, are also more flexible in some ways.

What’s Canvas? Canvas is an HTML tag, part of the HTML 5 standard:

<canvas></canvas>

By itself, it does nothing. But Javascript running in the page can treat the Canvas element as a freeform drawing area, and dynamically fill it with whatever combination of graphics and text you want. Things that would previously require a plugin like Flash, such as freeform animation and interactivity (although not sound), can be done easily in Canvas.

The advantage is that you can draw to the Canvas using Javascript, a language you probably already know if you’re a web developer, instead of learning a new domain-specific plugin language. Users of your page can interact with it without needing to have any plugins installed, and since it’s all part of the page they can see the source code simply by choosing “View Source”. (Though the last can be either an advantage or a drawback, depending on whether you intend to be open-source or not…)

Here are some examples of cool things you can do with Canvas:

One major drawback is that although Canvas works in Firefox, Opera, Safari, and Chrome, it is not yet supported by Internet Explorer. However, there are workarounds for this, such as Explorer Canvas.

Here are the presentation links:

The presentation is aimed at total beginners, so you should be able to get something out of it even if you barely know any Javascript yet.

Back in — oh, I think it was around 1991 — I had a book called Stupid Mac Tricks, which came with a 3.25 inch floppy disk of INIT files that you could drop into the System Folder on your (or your victim’s) Mac to make it do strange, funny, annoying, and useless things. It was a cool demonstration of what the Mac was capable of, and it inspired me (at age 11) to start on the road to hackerdom.

Stupid Mac Tricks was the inspiration for a presentation I did last Monday for the Design Challenge. It featured the following extensions:

  1. Menubar Madness, which turns all your menus names backwards.
  2. Dodgy Navbar, which makes the buttons in your navigation bar randomly reorder themselves when you click on them.
  3. Kittens Everywhere, which replaces every image on the web with random LOLcats images.
  4. Bookmarks and Preferences, which… actually, this one doesn’t do anything too wacky, it just shows how an extension can set bookmarks and preferences.

For each extension, I took the students through the source code, explained how it worked, and had them do a few simple modifications on each one to get a little hands-on experience. Even though you would never want to, you know, install any of these extensions (at least not on any copy of Firefox you want to be able to actually use…), each one demonstrates techniques that are very useful for advanced extension development. My intention was to make a follow-up to Myk’s Extension Development Bootcamp. Techniques demonstrated include dynamic manipulation of both the XUL and HTML DOM trees, using XPCOM, setting up event handlers, using overlays to replace attributes of XUL elements, using DOM Inspector to find elements you want to overlay, running code on page load, and using XmlHttpRequest. That’s a lot of stuff! I probably erred on the side of trying to cram too many contents into one presentation.

Oh well. It’s all online now, so you can peruse it if you’re interested in learning more about extension development. Here’s the links:

Labs is currently running a Design Challenge, in which design students from around the world are taking their ideas for the interfaces of the future from the initial concept through to a working prototype.

We’re doing a series of web seminars to help these students learn the skills they’ll need to complete their prototypes.

One of these tutorial sessions, taught by Myk Melez, is now up on the web in video form for public consumption:

Extension Bootcamp: Zero to Hello World! in 45 Minutes

If you’ve ever been interested in writing a Firefox extension, but never knew how to get started, then this is the one for you. Despite the title, it’s actually over 90 minutes long. Nevertheless, I highly recommend finding 90 spare minutes to follow along with Myk’s awesomely thorough tutorial. I honestly don’t think there’s ever been a better way to learn the basics of extension development.

For the past few Thursdays we’ve been doing something called an “Open Design Lunch” at Moz. We’ll pick a design problem that somebody’s working on and brainstorm it informally while munching pizza and burritos. Asa has been broadcasting these events on air.mozilla.com.

At today’s Open Design Lunch I brought up the question of how bookmarks should be accessed in Fennec. Bookmark management on Fennec gets extra tricky when you have hundreds (or thousands) of bookmarks from your desktop computer getting synced onto your mobile phone; so this problem is closely related to the UI design of Weave. My previous attempts to design a bookmarks UI haven’t solved these problems to my satisfaction.

The conversation didn’t conclusively settle anything (of course) but it brought up a lot of good ideas that deserve further investigation. Here’s the video:

(Note: These videos use the cutting-edge <video> tag from HTML 5, so they may not work for you unless you have the latest version of Firefox or another standards-compliant browser.)

Aza interviews me about Ubiquity and Weave. I do a bad Frank Zappa impersonation and some air guitar.

This is a tutorial I made to walk new command developers through the process of writing a Ubiquity command and sharing it on the Web.

Ubiquity Command Development Tutorial 1 (on Vimeo).

You’ll notice that I break my own rule here and give the command a hyphenated name. That’s because I did the recording several weeks ago, before I started working on the naming conventions stuff, and only today got around to finishing the video editing. I’ll fix the command’s name when I make part 2 of the tutorial, which will explain how to use noun-types, asynchronous requests, and other advanced stuff.

EDIT: If the vimeo link above doesn’t work for you, try this one instead.

Follow

Get every new post delivered to your Inbox.

Join 40 other followers