Time to Heal

This time is lush for healing The perfect lull-pause moment In life to reflect and breathe in Believing our thoughts are real Manifestations come true In the light of a new day We witness our Self…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




10 UI tweaks for web developers

You won’t believe how easy it is!

From UI to UX: tweaks to create an immersive user experience

This article is the fifth and final part of our series on creating interactive infographics with plain Javascript.

Previously we built a feature-rich User Interface (UI) to browse inter-connected information. In this article, we’ll demonstrate why it is so easy to create UIs with a human touch.

We’ll highlight ten UI tweaks that’ll transform a casual visit into a superior user experience.

At its core, UI design is just two words: contextualise and communicate.

To clarify, this story is not about design principals or Javascript itself. It is about the needs and challenges of the user. As such, the “correct answer” should vary from project to project.

Let’s see how that comes into play with practical examples.

Contextualise: How to present the information architecture without cluttering the display?
Communicate: Use transition effects to tell a story.

Before: The “usual” way of highlighting information.

After: A CSS tweak will give new dimensions to the information architecture.

A simple tweak to highlight the information architecture

Contextualise: How to reveal information hierarchy quickly?
Communicate: Stagger the entrance of containers progressively.

Before: A “typical” page load

Without staggered entrance

After: A staggered entrance highlights the information hierarchy instantly.

Tier-one. The core content, comprising text and media, are wrapped within a larger container to the far-right so that its implied order is noticable. Observe the ultrafast creation of the Youtube embedded element even as its parent container is generated on-the-fly. No worries on any video content slowing down your website.

Using staggered animation to reveal information architecture

Tier-two. The middle container shows summary information and related topics for users who are interested to find out more.

Tier-three. If users are indeed engaged, they can trigger the far-left container to reveal more information (see the demo from part-four of our story).

Initiate the “start/hidden” position of all containers.

Sequence the entrance towards the “end/show” position.

Contextualise: How to maximise the view and navigation space?
Communicate: Autohide unused UI elements during navigation events.

Before: Visible navigation space is halved. While users can view content on the “sticky” container, it is not needed in the midst of a navigation event itself.

Visible navigation space is halved

After: Since users won’t need the sticky container while navigating, we can safely fadeout the container to maximise view and navigation space.

Contextualise: How to “not-block” active elements?
Communicate: Autohide blocking elements in response to interaction events.

Fadeout the minimap so that it won’t “block” the mouse cursor when users are “panning” the canvas (a navigation feature discussed in part-two).

The minimap makes way for the mouse cursor contextually

boundingbox is a custom function to determine if the mouse cursor is currently hovering over the minimap.

Contextualise: How to use the “hidden dimension” to reveal a deeper information architecture?
Communicate: Emulate a see-through effect by manipulating the opacity level of the “above” element. The content of both the above and underneath layers are visible to help users visualise a more complete picture.

You can broaden the navigation view or create a sense of visual depth with just the opacity value. Notice the semi-visible layer underneath the minimap (top-left) and the sticky container (right-hand side)?

Contextualise: How to show related information only when it’s relevant (without a page reload)?
Communicate: Hide the information by default, but show on mouse focus.

A little background on the Google Cloud Platform (GCP). In the GCP world, PubSub is tightly integrated with other GCP products. While PubSub may be categorised under Big Data, it is also a key integration point for many GCP products. How can we feature this contextual relationship without cluttering the view? It’s not so complicated once we do this.

The technique is similar to how we would highlight the nodes (discussed in part-one of the story).

“Hide” the dotted line.

When we mouse-over the PubSub node, the eventlistener for the previously hidden dotted lines become visible. Note that other non-essential links become hidden. With just one line of code, you can achieve a funnelling effect on the user’s attention and tell a story without narration.

It’s almost mandatory to apply a fade-in fade-out transition.

Contextualise: How to show the contextual usage of the mouse cursor?
Communicate: Update the mouse cursor icon to signify different usage or behaviour.

Interacting with the minimap. Users drag the rectangular bracket (top left) within the minimap to update the canvas (main view). The cursor change from a default pointer to a four-way arrow.

Interacting with the main canvas. Users drag the main canvas. The location on the minimap updates concurrently. The cursor change from a “grab”(hand) icon to a “grabbing”(fist) icon.

Canvas navigation: updating mouse cursor from “grab” to “grabbing”

Contextualise: How to add contextual usage to the same mouse click?
Communicate: Differentiate a mousedown from a mouse click.

We want a left-click to do this.

The stand-alone left-click: “mousedown" and “mouseup” action in a rapid succession

We also want a prolonged left-click to do this.

The grab-and-drag action: a prolonged mousedown with a mousemove to drag things that end with a mouseup

As you can see, a left-click is not the same as a prolonged left-click. The later drags the canvas.

A mouse button can have dual usage and still feel intuitive. When a left-click is on mousedown, and not mouseup yet, it may mean either:

It’s trivial to implement. The trick is knowing what happens after the mousedown event is detected. Is there an immediate mouseup event or a mousemove event? The former suggests a “standard” click and the later a custom drag action.

If a mouseup is not detected within, say 300ms, then let the user drag the canvas.

In the main while loop (from part-one), listen to the mousedown event.

Add a custom function named clickTimer to determine whether it’s a click or a drag.

Since we’re only interested in knowing if the time interval is more than 300ms (not the same as the interval value itself), we can use a simple hack to do the job.

On mousedown, set mouseClick to true. However, after 300ms, set it to false.

Contextualise: How to transit from “in-browser” to full-screen mode?
Communicate: Provide a quick-toggle option.

Toggle-to-interact. Offer an option to go interactive. By default, the “in-browser” mode won’t block users from scrolling pass the canvas (also see scroll from part-two). A toggle will enable navigation from within the canvas.

Toggle to fullscreen. Offer an option to go fullscreen from “inline” mode to maximise navigation space.

Toggle between full-screen and inline mode

Contextualise: How to let users examine close-up details and still stay high-def?
Communicate: Use the mouse-scroll button to zoom. Use SVG to achieve unlimited scaling in high-definition.

Use the zoom API to increment or decrement size.

Contextualise: How to make UIs respond in a fluid and human-like manner?Communicate: Incorporate an easing function to create an intuitive experience.

Animation and easing effects work hand in hand to provide useful visual cues for users. One example is the original iPhone end-of-page “rebound” effect.

Let’s try this on our zoom example.

The result is a smoother start-stop curve that mimics a more natural response.

Why is easing a first-class citizen in UI design?

A simple tweak makes the difference between “just ok” and “just right”.

Perhaps due to its mathematical nature, as illustrated in the previous easeInOutQuad example (Tweak #10), easing may be an overlooked and underused feature. However, it can be very straightforward too. One line of CSS usually gets the job done.

CSS usage

Customised usage

Javascript equivalent

Easing is used extensively in our demo project. For example, the staggered entrance of the sticky containers are eased (Tweak #2). So are the scaling and highlighting effects of the SVG icons and connecting links (Tweak #1).

Let’s have some fun with easing.

The ballerina chasing the mouse cursor, with easing.

Some of the most complex UIs are built on top of the simplest ideas. Once we apply those ideas to contextualise the problem, we can create solutions that work better.

We’ve covered some of the most common Javascript techniques in the five-part series. There’s just one message that I would like you to bring home - anyone can create a compelling design with just simple tools; anyone can transform a casual visit into a superior user experience.

Part-one sets the foundation for designing interactive infographics.

Part-two adds navigation features to browse content.

Part-three adds a dynamic mini-map to enhance navigation.

Part-four adds an inline UI to access layered content.

Part-five → You’re are here. Yay!

Add a comment

Related posts:

the dreamkeeper.

There are stories. There always are- to breathe life into ink, to spin language into tapestries of wonder and comfort- such is our way. It runs in our blood as much as we claim war, and anger does…

A corda.

Eu tenho medo que você morra. Eu muitas vezes quero morrer. Fico aqui pensando se talvez a minha vontade de morrer seja proporcional ao medo que eu tenho que você morra. Melhor morrer do que passar…

Tre Cannoni

In the Ortler Alps in northern Italy is a minor summit called the Dreisprechenspitze: the ‘three-language peak’. For hundreds of years this tiny mountain was a tripoint — where Switzerland, Italy and…