Archive for October, 2009

Underestimated UI techniques: Morphing

When I design new applications, I realized I use a couple patterns that I haven’t seen in much use elsewhere, so I’ll start to blog about them. The first pattern in this series is called morphing.

What is morphing?

Bush-Obama morphing

Bush-Obama morphing

Morphing essentially describes a state change on an element, transforming it into another. Many UI frameworks have helpers for morphing, usually in the form of class animations. jQuery UI has made it transparent to animate jQuery’s class manipulation functions like addClass, script.aculo.us has Effect.morph which essentially does the same.

Why is it useful?

From a higher level UI perspective, morphing really describes that one element becomes another based on the context. It is essentially very powerful because it gives your users a visual cue what is happening, how is happening and why it is happening. Instead of doing an instant change, the users eye can follow the motion and you therefore give them a better feeling of control over the whole situation.

Show me!

Let’s do an example. While working on smart.fm’s new item builder, I had to visualize the following steps: Clicking on a button to add text, then displaying a text input, and hiding the button since you cannot add text twice. Usually, it would roughly look like this:

However, with morphing, it not only looks hot but solves the issue in style:

Hit me!

This was a particularly lazy example, since it doesn’t even truly morph one item into another – it just animates the width of the button and fades in the input on top. But visually, the element clearly transforms.

Morphing in the wild: Inline editing

One technique that was is heavily inspired by morphing is inline editing. Essentially, you click on a paragraph or element, and it transforms into and editable element. Most solutions don’t actually morph, but you get the idea. There are thousands of other usecases out there waiting to be discovered, and if you have some, I’d love it of you share them with me!

If Walt Disney was running a web business

I’ve long wanted to write about the little known Disney method, also called Walt Disney strategy. In fact, it is so little known that there’s not even an english Wikipedia article or reference about it, so here’s the german article, auto-translated by Google.

Walt Disney was not only known as great entrepreneur, but also as an individual who could switch easily between many different roles. Quoted from Wikipedia, he was “film producer, director, screenwriter, voice actor, animator, entrepreneur, entertainer, international icon and philanthropist“, and that’s only his official roles. The Walt Disney method essentially strips it down to three, sometimes four roles: The dreamer, the realist, the spoiler and the neutral. It is a highly effective creative method inspired by Disney, and can handle almost any product creation process. Before I’m going to explain how it can be applied to the web development world, I’ll first explain the basics.

The Disney method explained

Essentially a role playing strategy, the Disney method is said to work best with four different roles (I usually skip the forth though..):

  • Dreamer (visionary, delivering ideas)
  • Realist (doer)
  • Spoiler (critic)
  • Neutral (consultant, reviewer)

Take four chairs and mark them with above roles. As single technique, it is recommended to start within the neutral position to analyze the problem. I, however, recommend to start as dreamer, since there’s in fact not always a problem you want to solve. When you’re sitting on the first chair, you start brainstorming until you have a beautiful complete vision. As soon as the dreamer in you is happy, you move on to the next chair, taking the role of the realist. You analyze the dreamer’s ideas and make sure they’re implementable, or strip them down accordingly. When you think it works out, you pass your product to the critic, who will then try to find anything possibly wrong with it. When the though review is done, take a deep breath as neutral consultant to review everything from a bird’s perspective, and explore if every chair role is happy. If they’re not, simply continue your circle: Pass the dreamer the finished implementation and critique, and let him explore different or additional directions. Do those steps, until everyone is considerably happy with the product.

The whole strategy can of course also be applied to groups of people, meaning you have a full discussion going on between the roles, and every couple minutes you move places. However, I highly suggest trying out the single variant, because it proved to be much more effective for me personally.

Applying it the web development

As already mentioned, the Disney method can be applied to almost any situation. Let’s apply our roles to the web development world and see how they would look like:

  • Dreamer becomes Designer, Prototyper
  • Realist becomes Engineer
  • Spoilers become your users, investors

Note that I skipped the neutral role, because the new spoiler is essentially both, and it allows for faster iteration. Now that we have a fully working cycle for a web development situation, let’s narrow it down and focus on individual implementation aspecs:

Going into detail: Implementation roles

If it’s not working well enough on a high level like above, you can always narrow it down to more granular roles. As an example, I’m taking the engineer role, and splitting it up into three:

  • Model
  • View
  • Controller

or how about this one:

  • Rapid prototyper
  • Frontend engineer
  • Backend engineer
  • Performance Guru

As you can see, there are endless possibilities.

Now why should I do it anyway?

The whole point about the Disney method is that it allows you to understand your co-workers, the flow of a product, and the most effective path to your end goal. It gives you the chance to have a look at each role’s unique perspective, how they see themselves and others around them, and when mastered, gives you a bird eye or global view that incredibly improves your leadership or individual role. If you do it a couple times, it’s very likely you start projecting your 4 chairs on your actual co-workers and naturally improve the workflow.

Switching between different roles is a unique and highly rewarding skill. I personally believe that this particular skill let Disney become the legend he is today. If Walt Disney was running a web business, he would simply add a couple more roles to his mind model and start to build up highly successful web products.

Now go ahead and grab some chairs!

Why I would hire game developers for my startup

This is one of the ideas I’ve only realized now in context but always knew deep in my mind. Whenever I talk publicly, I talk about pushing the limits of the web. My startup ideas are nothing different – every idea I have pushes the web to its greatest limit to deliver the most impressive result.

Perfectionism vs. trying to be awesome

Note that all ideas I have, and everything I’ve presented so far is not related to being perfect or delivering the perfect web product. Perfectionism is extremely dangerous, and chances are you never get the job done. In fact, many of my labs demos are far from perfect, even stable, but they push the limits. They deliver awesomeness. They provide great experiences.

Looking at games

Why games? It’s actually really simple. While web developers have been whining for years and have been stuck in their despair, game developers never stopped to amaze with the little tools and possibilities they’re given. 3D on a Super Nintendo? Easy. Full blown 3D RPG on PlayStation 12 years ago? You bet. Yes, game developers deliver.

Cheating and optimizing

Why are game developers so different, and what are they doing? Well, for once, they’re simply cheating. Remember Final Fantasy VII, the greatest selling role playing game of all time that lead Sony’s success of the PlayStation? Since the limited 3D capacities where not enough to deliver a great experience at times, they simply uses prerendered scenes and mixed them with live renderings. Yes, 1997. The even bigger point though is the optimization efforts that are made. Web developers only optimize when they see performance issues. For game devs, they know from the beginning on that the console they’re developing for cannot handle the raw 3D data, so they need to find optimization patterns right away!

They for instance need to control the number of polygons on the screen, memory consumption and frame rates. Many 3D techniques developed in the last 10 years are in fact optimization techniques, that either deliver a richer experience with the current hardware, or consume much more energy to be able to use much more of the same.

Delivering

Most importantly, game developers aren’t afraid of going different routes if something doesn’t work out. They try hard to deliver the experience they’ve planned, not the actual expact specification. Whenever I work on new projects, I ask myself “how would a game developer do it in a game?”. This usually gives me brilliant new ideas, and I highly suggest you try it out!

Now if only I could convert some game developers to start over in the web world… :)

A UX pattern: Reusable hints with jQuery

Update (1): The CSS source had wrong formatted comments and the markup was using class instead of id, please update your sample code when you grabbed it earlier!

Update (2): Please find a working demo here: Hints demo

When building nifty UI solutions, always keep in mind that in order to make your target audience use your cool features, you must teach them. The iPhone is to a certain extend only intuitive because they have the marketing power to teach people on TV how to do pinches and swipes. Anyway, since most budgets are smaller, let’s try to achieve the same with contextual hints.

Contextual hints are basically help bubbles that pop up as soon as you are in a certain context. They can also serve as an application walkthrough or tutorial. If you build a todo list, the first hint you would show your users would be sticking on top of the “Create new todo” button, and would tell you something like “Why don’t you click here and create your first task?”.

I’m sure you got the idea, let’s build a very simple solution without any graphics (The downside: Will not look too good in IE..). First, we need to create the markup for the hint:

<div id="bubble">
	<span class="content"></span>
	<div class="pointer"></div>
</div>

Sweet. We just have the outer bubble element which has the id #bubble, a content div that will hold our text and a pointer div which we’ll transform to a nice triangle. Next, let’s do the CSS:

#bubble {
	background: rgba(255,255,255,0.9); /* use rgba to let the bubble shine through a bit */
	font-size: 1.2em;
	padding: 1em;
	width: 22em; /* the bubble needs a certain width since it's absolutely positioned */
	-moz-border-radius: 1em; /* give the bubble nice rounded corners */
	-webkit-border-radius: 1em; /* ...in both gecko and webkit */
	position: absolute;
	z-index: 100; /* give it a high value here to lie on top of all other stuff */
	opacity: 0; /* opacity must be set to zero at beginning (use filter: alpha(opacity=0) for IE) */
}

#bubble .pointer {
	position: absolute;
	bottom: -1em;
	left: 2em;
	width: 0;
	height: 0;
	border-style: solid;
	border-color: rgba(255,255,255,0.9) transparent transparent transparent; /* make sure only one border side is shown */
	border-width: 1em 2em 0em 1em; /* this is called a border slant and creates the shape of the triangle */
}

Obviously feel free to customize everything related to styling, font size etc. Next, we want it to see come all together by doing the JavaScript/jQuery work:

$.fn.hint = function(msg) {

	var offset = this.offset(), // generate the offset position of the hinted element
		bubble = $('#bubble'), // cache the bubble as jQuery
		pointer = $('.pointer', bubble), // cache the pointer of the bubble
		fadeDistance = 50; // the distance from where the bubble will fade in

	// append the message to the bubble, position it and slowly fade it in
	bubble
		.find('span.content').html(msg).end() // insert the new message
		.css({
			top: offset.top - bubble.outerHeight() - pointer.outerHeight() + this.outerHeight()/4 - fadeDistance, // the element offset minus the height of the bubble, minus the height of the pointer, plus one quarter of the height of the element to be on top of it, minus the fading distance
			left: offset.left + this.outerWidth()*0.75 - 42 // the element offset + 3/4 of the element's width to position the bubble at the right side, minus the pixel width to the edge of the triangle
		})
		.animate({
			opacity: 1, // fades it in
			top: '+='+fadeDistance+'px' // moves it in from the fade distance that we substracted above
		}, 600);

	// make sure the bubble goes away when clicking on the hinted element
	return this.one('click', function() {
		bubble.animate({
			opacity: 0, // fades out
			top: '-='+fadeDistance+'px' // animate back the fade distance
		}, 300);
	});

};

That’s it. Now all you need to know is it’s usage, but you probably know it already:

$('#myButton').hint("Click here to make it explode.");

This will blend it your hint, and as soon as you click on the element, it will fade away again. Sweet, huh?

A plugin so short it’s tweetable: Mask

I recently found the need to create a utility that helps me to mask a series of elements with a background image that spans across them, so the the picture basically gets masked by the elements selected. I couldn’t find a sweet reusable solution out there, so I went ahead and created my own little jQuery mask plugin. Here’s the code:

$.fn.mask = function(u) {
	return $(this).each(function() {
		var p = $(this).position();
		this.style.background = 'url('+u+') -'+p.left+'px -'+p.top+'px';
	});
};

Here’s how to use it:

// grab all li's on the page and mask them with a certain image
$('li').mask('http://farm3.static.flickr.com/2075/2509376094_737cce37d4_o.jpg');

Most interestingly, this was the first actually useful plugin that was tweetable in it’s entirety: http://twitter.com/pbakaus/statuses/2492305298. Enjoy!