Inspiration

Inspiration

The coverflickr3

When I was refreshing my labs and updated them to fit the corporate Dextrose design (http://labs.dextrose.com), I quickly figured that I wrote quite a few plugins in the past that still deserve a lot more attention, because they are..well… kind of awesome.

In order to receive more attention, plugins like Coverflow need a kickass demo. Before, I only had small image demos in a small canvas, which weren’t quite as effective, so I decided it’s time for a killer mashup: Meet the Coverflickr.

Coverflickr in action

The Coverflickr is a mashup experiment to show the beauty and flexibility of the Coverflow plugin while making use of a multitude of new HTML5 features. It’s an interface for browsing Flickr’s interesting images in a graphically sophisticated way. It is best experienced in Safari (even better : Latest webkit nightly!) or Chrome, although it will run smoothly in Firefox 3.5+ (minus preview animations and reflections). Here’s the techniques that are being used in the Coverflickr for those who care:

  • CSS box reflections combined with CSS gradients for the reflections
  • CSS Transforms for the preview mode and within the coverflow plugin
  • CSS Transitions for the preview mode and the alternate mode switching animation
  • YQL for the fetching of the images

There are a couple not immediately visible but pretty neat features going on here. For them, I had to significantly alter the coverflow plugin (soon to be released in a new version):

  • Endless browsing. When coming to the right end, it fetches more images, appends them to the list and refreshes the coverflow with the new method “refresh
  • Alternate transformations.Click on the bottom link “Alternate version” and the transformation will animate live into another one now using rotations. The coverflow plugins transformations can now be exchanged on the fly through the “transformation” option.

This has been an incredibly fun demo to do, and I realized it wouldn’t be possible to do so without the help of the Webkit project, pushing the web like nobody else. I therefore dedicate this demo to the Webkit team, my personal heros that are not afraid to pioneer new features for the greater (web developer) good.

Enjoy, and let me know if you like what you see (also if you don’t, but please be kind)!

Unleashing your power with music1

In one of my productivity articles I wrote about how music can help you gain and maintain productivity. Today, I’ll tell you about a special method how to find the right tunes.

First of all, forget about the crap clear your mind about what you know and learned about productivity music or sounds. Things like “listen to nature’s tunes” and the likes. This might be a good, but too general advice. Also don’t think about music that helps you relax or focus. What you essentially are looking for is music that let’s you *perform* well.

So how to find what you need? Listening to a thousand songs while working and then trying to guess what worked best usually doesn’t work: Simply because your job is probably too complex and not repetitive enough to give you a clear idea of which 3 minute song actually worked best.

All hope is not lost though – the answer is simple. Find something that you deeply want to achieve or perform well on, but is simple and repetitive enough to actually feel and catch the results immediately. Tetris, anyone?

Games

Yes, I’m talking about videogames. The sort that is highly addictive and entertaining and lets you run after a certain achievement for hours. The most famous candidate here is Tetris – if you’re looking for something “fresher” on the iPhone, try Doodlejump! My personal choice features a jumping character with only one target: Jumping higher and higher.

With the aid of Doodlejump, my iPhone and my portable music library, I immediately see results when I’m listening to a song that works. Yes, it’s dead simple. Yes, grab your phone and try now! Enjoy!

Array.toObject2

This is another tiny helper I’ve just realized I need badly. I often do something like this to convert Arrays holding Objects into Objects holding Objects for easier lookups:

var newObject = {};
for (var i=0; i < someArray.length; i++) {
	newObject[someArray[i].id] = data[i];
};

I realized this can be beautified a bit by creating Array.toObject:

Array.prototype.toObject = function(f) {
	var o = {};
	for(var i=0; i < this.length; i++) {
		o[f.call(this[i])] = this[i];
	}
	return o;
};

This very simple function lets you transform the above code to

var newObject = someArray.toObject(function() {
	return this['id'];
});

Arguably it is not much shorter, but simpler. The anonymous function is needed because we need to tell the toObject function how to build up the Object key for each Array entry. Cool enough, this doesn't only work with Objects now, but with any kind of Array data. If in fact we know we're only dealing with Arrays holding offsets, we can optimize:

Array.prototype.toObject = function(key) {
	var o = {};
	for(var i=0; i < this.length; i++) {
		o[this[i][key]] = this[i];
	}
	return o;
};

..which then lets us do:

var newObject = someArray.toObject('id');

Now that's better, no? Enjoy :)

Why tabs are often a bad idea2

This article was also released as guest blog on SixCrayons.

There was a time a couple years ago when the world needed browser pop-ups. It was awesome – it gave you the technology to launch a dedicated part of your website in a new window, and opened countless possibilities for the booming market of internet advertising. That certain factor of ‘coolness’, however, made people blind -they did not understand that popups had literally no user experience benefits at all (prove me wrong if you dare!).

Just at this very moment, history is repeating itself once again. Now, everyone completely agrees that popups are sooo 199-something and distracting, and bad UX alltogether. Everyone wants tabs now.

The problem of tabs

What’s wrong with those tabs then? Well, actually nothing! Tabs are awesome, and I couldn’t imagine going back to a browser that doesn’t feature them. The problem really isn’t about tabs (Klaus should be relieved now!), the problem is how people intend to use them.

What are tabs good for?

To start with an easy concept, tabs basically allow you to distribute content into several containers that can individually be activated one at a time, thus saving screen real estate. Tabs can be static or dynamic, meaning they can be opened and closed, and work excellent in situations where you’re opening instances of the same content format. Take a browser, for instance: You’re essentially opening websites all the time – content containers with the format “Website”.

What are tabs not good for?

The obvious issue people don’t realize is that only one tab can be visible at a time because they’re sharing the same visual position. This is the big issue : Tab do not work when the content is..

  1. ..of a completely different (visual) layout
  2. ..meant to be visible all the time
  3. ..needs to be easy comparable against other content
  4. ..important content

Of those three, the third and forth are probably the most important to realize. If you are currently utilizing tabs on your site, think for a bit if not seeing the complete content currently distributed is a disadvantage, or in other words: Does the UX become better if all content is visible at once? If your content is vitally important, do not hide it within secondary tabs! All tabs require user activation, and makes your content less visible.

Conclusion: be reasonable!

If your screen is getting crowded next time and you’re thinking about utilizing tabs, take a minute and think about the above mentioned issues. It might very well be that tabs work perfectly in your situation – it’s when you realize the tabs do not restrict the user experience.

Cheers!

Underestimated UI techniques: Morphing8

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:

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 business3

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 startup9

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 jQuery7

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: Mask0

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!

Totally uber: Webkit 3D Ubercarousel + Uberplayer now in HD!4

Hey everyone, it’s time to get some demos out once again!

First off, I was really impressed when I found out that Webkit now has now ported over 3D CSS Transforms over from the iPhone webkit fork, and they showed us some really cool demos a couple days ago. Obviously I couldn’t resist and grabbed a bunch of them, transformed them over hours only to recreate one of my plugins with some extra webkit spice. Meet the Ubercarousel!

Note: You need to download a nightly of Webkit in order to see this!

The Ubercarousel in latest Webkit nightly

The Ubercarousel in latest Webkit nightly

The Ubercarousel is using almost every latest CSS enhancements build into Webkit (including CSS 3). Here’s a quick list:

  • CSS Gradients for the overall background and the reflection (yep, shamelessly ripped from the webkit demo ;)
  • RGBA (on the control panel and the debug backgrounds)
  • 3D Transforms (Rotation and translation on the Z Axis)
  • CSS Animations (For the spinning animation and the wobbling)
  • CSS Transitions (for the hovering of the images)
  • CSS Reflections (using a gradient)
  • Appearance (For the sliders, it’s a range input)

Functionality wise, it just grabs the 100 most recent interesting pictures from Flickr and displays some of them in the carousel, enlarging them when you hover. While working on this demonstration, I found out about a couple bugs and hit some walls, but generally I was extremely impressed of how well you can combine various new enhancements. To mention some issues, the inner <img> tag needs a “translateZ(0px)” or otherwise the images will be blurry, gradients don’t animate and are generally hidden when something is transformed, and transforms that are applied on :hover don’t play well with the wobble animation.  Anyway, have fun!

Uberplayer now in HD!

On a side note, Google finally added support for HD playback for their chromeless player, so from today on, the Uberplayer supports HD playback. Enjoy!