Adding Animation to an External Control
12 August 2009 by Rob Spectre

One of the elements I liked most in building the UI for AL TV was the drawer animation coming from under each thumbnail to provide the label of the ListItem. That UI mechanic is present all over the Boxee application and using it leaves more screen real estate to fit in a greater number of thumbnails.

Show me your drawers.

Show me your drawers.

The implementation was easy – two “slide” animations on the label and a background image for the ListItem in the panel container.

<animation effect="slide" start="0,-100" center="auto" time="200">Focus</animation>
<animation effect="slide" end="0,-100" center="auto" time="200">Unfocus</animation>

zOMG! Those thumbnails totally drop their drawers when you focus on them now.

Having opposite elements for Focus and Unfocus, the drawer slides cleanly out and back in as a ListItem receives and loses focus. When starting out developing my new Associated Press app, I knew I wanted to leverage a similar mechanic, but was unsure if it would fit with the app’s feel. The target length of experience, breadth of content, and probably userbase for each app probably didn’t share much on the Venn Diagram.

Making a news app look like a music video app wouldn’t please many users, after all, and the AP content lent itself to more of a scrolling ticker list design, a la Auto-Tune The News.


Youkilis suspended?! But why?

A panel, album-cover like navigation was totally out for the AP experience, which I envisioned being brief, daily and ubersimple. Only one thumbnail visible from 30 feet away and text bigger than Jesus. A drawer would be great for the meta information like publish date and description, but those would be located in a label external to the list container. Without performing the animation within the list container, how would I be able to get the drawer effect I was looking for? The answer is the “condition” attribute. Just as the value of the animation elements used in AL TV were the conditions we desired – Focus and Unfocus – so to can we set arbitrary conditions using the Boxee API. Consider the following XML:

<animation effect="slide" start="0,-105" center="auto" time="200" condition="Control.HasFocus(111)">Conditional</animation>
<animation effect="slide" end="0,-105" center="auto" time="200" condition="!Control.HasFocus(111)">Conditional</animation>

Instead of the value of the animation element being our desired behavior, we instead choose “Conditional” and then use the condition attribute.

Ah.  With focus we can see the metadata, which tells us he was suspended for punching out a douchebag from the Detroit Tigers.  Well done drawer animation and well done Youkilis.

Ah. With focus we can see the metadata, which tells us he was suspended for punching out a douchebag from the Detroit Tigers. Well done drawer animation and well done Youkilis.

In this case, we use the Boxee API to determine if our list container does or does not have focus. If it does, pull out the drawer with the metadata. If it does not, slide that back up cleanly as the user clicks on other things. This simple animation did much for the professional, clean design of the app, except the slide would always happen before the list container was finished parsing the RSS feed. To prevent this, we can use the visible element to make sure it plays nicely and waits until the RSS is finished loading.


This same attribute can be leveraged for all kinds of zooms, fades, and rotates to killer effect, limited only by your imagination in terms of the use cases. GetWindow, ActivateWindow, IsPaused and many other methods can trigger animations that would be useful to the user. You can see this tip in action with the Associated Press app, soon to be published in the App Box.

»  Substance: WordPress   »  Style: Ahren Ahimsa
© 2009, all rights reserved.