Violet Hill

Violet Hill

spacer

Sunil Arora  //  

  • Edit
  • Delete
  • Tags
  • Autopost
 
Mar 10 / 10:03pm

Highlight Call to Action by giving a small Wiggle

Today, when I was trying out a new application bufferapp, I noticed something very interesting in their interface which immediately caught my attention. Although it is a tiny little detail about the interface, but I think it is one of the very important ones especially in context of a web app, so I thought of writing it down.

If you have used bufferapp, you will notice following things (shown in the picture below):
  • High level navigation at the top (header section).
  • Notification with some call to action right beneath the header section (in this case Install Chrome extension)
  • Main content section which is about buffering your tweets. 
spacer
The detail that I wanted to point out was, when I am navigating from bottom section to the header section, I would see "install" button wiggles for a moment. Now that momentary wiggle made me pay attention and read that message to understand install what ?  It felt exactly like as if you are navigating through your office corridor and someone calls you out to show you something. So this "wiggle for .2 seconds" was almost like someone calling out to make sure I read that message. You can see this in action here in modern browsers specifically Chrome, Safari or Firefox.

You will see this layout pattern in lot of places where application is trying to communicate something important to the user and would like him/her to take an action like in this case Buffer wanted me to install their chrome extension as I was using Google Chrome. Typically, users develop a blind eye to some of these layout patterns and it becomes very challenging for the interface designer to craft an experience which could draw user's attention to an important action.

These simple but important details separates a good design from a great design. In rest part of the post, I would throw some light on implementation details for this wiggle effect. Most of the modern browsers support animation through CSS3 these days.

keyframe definition for wiggle effect would look like this: (omitting the browser prefix for better readability)
@keyframes wiggle {
   0% { transform: rotate(2deg); }
   50% { transform: rotate(-2deg); }
  100% { transform: rotate(2deg); }
}
Think of keyframes directive as defining a animation function which will be called later on elements like buttons in our UI. We implement wiggle function by first rotating the subject by 2 degree anticlockwise, then to 2 degree clockwise and then rotate it back by 2 degree anticlockwise.

Let say our html markup for flash message looks like this:

<div>
     Install Now
</div>
Inorder to invoke it on a mouseover of the flash message block. Our invokation code in CSS would look like this:

.flash_message:hover a.call_to_action {
  animation: wiggle 0.2s;
}

Here is a live demo which I have hosted on github and the code can be found in wiggle repo.

This is a classic example of applying CSS3 techniques at the experience layer in your application. Let me know what you think of such experiences, drop a note below in the comment section or tweet me @_sunil_ .
Tweet
Filed under  //  css3   css3 animation   highlight call to action   wiggle effect  

Comments (0)

  • Edit
  • Delete
  • Tags
  • Autopost
 
Feb 25 / 11:25pm

Asynchronous IF implementation using JQuery Deferred Objects

I ran in to a situation in a project recently where I got an opportunity to use JQuery Deferred Objects. I wanted to implement an Async IF operation. Async IF operation is like watching a condition to become true (may be in future) and then invoking something when it becomes true. So this is essentially an "if" operation in async mode and your logic might involve watching more than one condition to be met.

For example:
Consider a demo web application where colored boxes (red or green) can appear on the screen depending on some logic or user action. We want to do certain things if a red box appears or a green box appears or both of them appears.

Let say we we want to do something when a red box becomes visible on our screen, so it will look something like this:
async_if is_box_visible, "red"
whenever it is true, then do_something

Another one, let say, we want to pop up blue box when we see red and green boxes are visible on our screen for the first time, so it will look something like this

async_if is_box_visible, "red"
async_if is_box_visible, "green"
whenever both the above are true, then inject blue box

So here we are composing operations which involves some async operations because we do not know when these conditions will be met. This is exactly where Deferred objects shines.

I prepared a demo for the above scenario and rest of the part, I will walk you through some samples. I have shared the entire code in github repository at async_if. You can see the demo here.

Async IF Operation: It is a generic construct which takes two arguments:
  • A function which checks a condition (lets call it checker function henceforth)
  • Arguments to be passed to the checker function
  • timeout (milliseconds) for reporting failure if condition is not met within timeout milliseconds

Async IF operation returns an object of type Promise which can be used to compose higher level application logic using jquery's operations around deferred objects. Following javascript code is generated from the coffee script async_if.coffee.

Use of Async IF Operation: In code below, we are trying to build logic which is when red and green box both appears on the screen, inject a blue box on the screen. Now appearance of red and green box is purely async which will happen on user action like "injecting a box" by clicking on buttons in the demo application.

You can read more about when operations here (api.jquery.com/jQuery.when/)

Let me know your thoughts about this construct. Drop a note below or contact me at @_sunil_
Tweet
Filed under  //  Async IF operation   async operations   jquery deferred  

Comments (1)

  • Edit
  • Delete
  • Tags
  • Autopost
 
Sep 18 / 8:25am

PyCon India Presentation on Redis And Python

Pune (India) witnessed probably the second biggest PyCon event this year. It was third PyCon to be held in India and was very successfull event.

I took a comprehensive tutorial on Redis & Python subject. I am embedding the slides from the same session below.

Redis And python at pycon_2011
View more presentations from sunilar0ra

Hope you will find it useful. Ping me @_sunil_ if you have any questions.

Tweet
Filed under  //  Redis   pune pycon 2011   pycon india   python   sunil arora  

Comments (1)

  • Edit
  • Delete
  • Tags
  • Autopost
 
Jul 30 / 11:20am
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.