<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pre 101 &#187; Programming</title>
	<atom:link href="http://pre101.com/blog/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://pre101.com/blog</link>
	<description>Getting the most from your Palm Pre</description>
	<lastBuildDate>Wed, 12 May 2010 19:11:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Palm at CES 2010 &#8211; 3D, Video, Pre and Pixi Plus and More</title>
		<link>http://pre101.com/blog/2010/01/09/palm-at-ces-2010-3d-video-pre-and-pixi-plus-and-more/</link>
		<comments>http://pre101.com/blog/2010/01/09/palm-at-ces-2010-3d-video-pre-and-pixi-plus-and-more/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 01:38:18 +0000</pubDate>
		<dc:creator>Pre101</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[app catalog]]></category>
		<category><![CDATA[ces]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[verizon]]></category>
		<category><![CDATA[webOS]]></category>

		<guid isPermaLink="false">http://pre101.com/blog/?p=818</guid>
		<description><![CDATA[It was one year ago at CES that Palm introduced webOS to the world.  This last Thursday, Palm again presented at CES.  Expectations were running very high and Palm did not disappoint.  Palm announced new networks, new revisions of the Pre and Pixi, new developer tools, new software features and more.  We&#8217;ll cover the presentation [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pre101.com/blog/wp-content/uploads/2009/08/PalmLogo.jpg"><img class="alignright size-full wp-image-216" title="PalmLogo" src="http://pre101.com/blog/wp-content/uploads/2009/08/PalmLogo.jpg" alt="PalmLogo" width="116" height="116" /></a>It was one year ago at CES that Palm introduced webOS to the world.  This last Thursday, Palm again presented at CES.  Expectations were running very high and Palm did not disappoint.  Palm announced new networks, new revisions of the Pre and Pixi, new developer tools, new software features and more.  We&#8217;ll cover the presentation in detail and even give you the opportunity to view a video of the presentation.  Keep reading.</p>
<p>Jon Rubinstein, Palm&#8217;s Chairman and CEO, took the stage in Las Vegas to recount where Palm&#8217;s been and tell us where Palm&#8217;s going.  Click on the video to watch the entire 50 minute presentation.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Mn6oNKVd29g&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/Mn6oNKVd29g&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The follow are the key points:</p>
<h3>Hot Apps Bonus Program</h3>
<p>Katie Mitic, Palm&#8217;s SVP of Product Marketing, announced <a href="https://developer.palm.com/index.php?option=com_content&amp;view=article&amp;id=1841&amp;Itemid=35">$1 million in prizes</a> to be awarded to top webOS developers.  The prizes are open to both free and paid apps developed using Palm&#8217;s existing Mojo SDK.  The prizes are tiered as follows:  $100,000 each to the top downloaded free and paid app, $10,000 each to the developers of the next two most downloaded free and paid apps and $1000 each to the developers of the next 200 most downloaded free and paid apps.  The download period will be between February 1, 2010, and May 31, 2010.  Drop by the newly relaunched <a href="https://developer.palm.com/index.php">Developer Center</a> to get started developing your app today.</p>
<h3><a href="http://pre101.com/blog/wp-content/uploads/2010/01/THE-SIMS-3_splash.png"><img class="alignright size-full wp-image-824" title="THE-SIMS-3_splash" src="http://pre101.com/blog/wp-content/uploads/2010/01/THE-SIMS-3_splash.png" alt="THE-SIMS-3_splash" width="240" height="160" /></a>3D Gaming Comes to the Palm Pre</h3>
<p>The announcement that got the most reaction was the release of 3D accelerated games, made available by Palm&#8217;s new <a href="https://developer.palm.com/index.php?option=com_content&amp;view=article&amp;id=1850&amp;Itemid=20">Plugin Development Kit</a> (or PDK).  Joining Palm onstage to make the announcement was Travis Boatman, VP Worldwide Studios for EA Mobile, who introduced some of their new titles.  In all, twelve PDK titles are available in the App Catalog, including the much hyped Need For Speed Undercover, The Sims 3, X-Plane 9 and Tetris.  You can see a video review of Gameloft&#8217;s Ashpalt 5 on <a href="http://www.webosroundup.com/2010/01/asphalt-5-review/">WebOS Roundup</a>.</p>
<p>More important than the release of these twelve games, though, was the PDK itself.   The PDK allows for development of applications that work with webOS but that are developed with C and C++ &#8212; in other words, native applications.  One of the criticisms from some developers is that Palm&#8217;s Mojo SDK, based on HTML, CSS and JavaScript, is too slow for some types of applications.  The PDK, and the fact that Palm has been testing this with some partners possibly since the release of webOS, indicates that Palm was well aware of this and has a solution.</p>
<p>While we&#8217;re excited about the release of the PDK we&#8217;re not sure that the capabilities of the Canvas element have been fully realized by game developers.  As <a href="http://zammetti.com/blog/2010/01/09/thoughts-on-palm%E2%80%99s-ces-showing/">Frank Zammetti</a> pointed out, there is a tremendous potential for applications developed with existing Web standards.  Particularly as we see technologies such as WebGL get included in webOS.  Further, battery draw from games that tap the GPU will likely be big issue.</p>
<p>The PDK is scheduled for release in March on the Palm Pre and a later date for the Pixi.  In case you missed the significance of the statement, the 3D games available today in the App Catalog are only available for the Pre, not the Pixi.  Those missing 80 pixels could be very significant indeed.</p>
<h3>Video Recording, Editing and Sharing</h3>
<p>Those of you who&#8217;ve been following the homebrew announcements knew that video recording is possible on existing webOS devices.  It was only a matter of time before Palm incorporated the feature into the OS.  Palm demonstrated their upcoming video recording functionality at CES.  What they also demonstrated was the integrated video editing and sharing capability.  With a few clicks, Paul Cousineau, Director of Product Marketing at Palm, edited a video he shot live at the event then uploaded it to You Tube.  After it was uploaded, he used another feature to share the video with his Facebook feed.</p>
<p>Many have criticized Palm for not having the feature available before now.  Hopefully, this very slick implementation will go a long way towards smoothing any ruffled feathers.  What&#8217;s more important is that this feature will be included with webOS 1.4, another free update available to all webOS devices sometime in February.  Although it wasn&#8217;t discussed, we hope that audio recording will also be included in 1.4.</p>
<h3>Flash 10.1</h3>
<p>It was confirmed that Flash 10.1 will be available soon.  According to Paul Cousineau Flash 10.1 will be available for download from the App Catalog.  This feature will open up the Web even further for webOS devices.  Some have pointed out that the recently announced <a href="http://www.slingbox.com/go/spm">SlingPlayer</a>, being Flash-based, will work on webOS, allowing you to watch and control your TV on your Pre or Pixi.</p>
<h3><a href="http://pre101.com/blog/wp-content/uploads/2010/01/pixi-plus-pre-plus.jpg"><img class="alignright size-full wp-image-825" title="pixi-plus-pre-plus" src="http://pre101.com/blog/wp-content/uploads/2010/01/pixi-plus-pre-plus.jpg" alt="pixi-plus-pre-plus" width="350" height="294" /></a>The Pre Plus and Pixi Plus</h3>
<p>Palm also showed off the Pre Plus and Pixi Plus smartphones at CES.  The Pre Plus sports double the memory and storage (512 MB RAM, 16 GB Flash) of the original Pre and sheds the center button.  The Pixi Plus adds WiFi and more storage and memory.  Both devices will ship with Touchstone compatible backs.  These two phones will be Verizon exclusives (see below).  No doubt the increased memory and storage will be important for applications developed with the PDK, as many users have noted that the 3D apps sometimes fail to launch with the dreaded &#8216;too many cards open&#8217; message.</p>
<p>Another Verizon exclusive will be the ability to use the Pre Plus or Pixi Plus as a MiFi hotspot, allowing up to five devices to share the 3G connection.  All you&#8217;ll need to get your laptop online is the app and a webOS device on Verizon.  What was not disclosed is how much the data plan for that will cost.</p>
<h3>New Networks</h3>
<p>Palm announced two new network partners at CES:  SFR in France and Verizon Wireless in the US.  As mentioned above, Verizon will be getting an exclusive on the Pre Plus and Pixi Plus (at least in the US).  Verizon currently has about double the subscriber base of Sprint in the US so this opens up a huge market for Palm and app developers.  What remains to be seen is how Verizon will promote the Pre Plus and Pixi Plus.  If they are half as successful as they were with their Droid Does campaign then the more consumer-focused webOS devices will sell very well.</p>
<h3>Analysis</h3>
<p>It seemed that Palm&#8217;s announcements were targeted very strongly towards developers.  Palm realizes that in order to compete with Apple and Android its important to have apps.  The opening of the developer program, the freeing of the app distribution process, the Hot Apps program and the PDK all point to the fact that Palm is deadly serious about expanding its App Catalog.  Palm is actively courting developers and is making it clear that they embrace openness, even giving a &#8216;shout out&#8217; to the homebrew community at CES.  This is very exciting news and this strategy will very likely bear fruit.</p>
<p>What a strikingly different out-of-box experience awaits those users whose first webOS device runs webOS 1.4 as compared to those of us who started with the first release of webOS.  Certainly the underlying OS that we all love hasn&#8217;t drastically changed but the power, features and available apps have grown tremendously.  Kudos to Palm for the customer focus and rapid updates.  This is clearly one area where Palm outshines Apple and Android.  Many Android devices are stuck on older versions of the OS and are unlikely to ever see updates and Apple&#8217;s releases are slow in coming.</p>
<p>Prior to CES we predicted a number of things.  We got most of them right.  We missed on seeing a non-Palm branded webOS devices and we didn&#8217;t have any clue about the Hot Apps program.  However, what was most important about CES is that Palm has again generated buzz.  They showed that Palm was not to be ignored in the smartphone wars of 2010.  They reinforced that they are committed to extending the functionality of their devices through more updates to the OS.  They showed they&#8217;re committed to reaching more end users.  We think 2010 will be a great year for Palm and a great year for webOS users.</p>
<h3>Other Reviews of Palm at CES</h3>
<p><a href="http://digitaldaily.allthingsd.com/20100108/rbc-on-palm-2010/">All Things Digital</a> agrees that Palm has shaken things up once again.  <a href="http://mobile.slashdot.org/story/10/01/08/1925203/Palm-Opens-Dev-Program-Offers-1M-For-Top-App">Slashdot</a> has some coverage of the Hot Apps Program.  <a href="http://arstechnica.com/gadgets/news/2010/01/palm-updates-devices-opens-app-catalog-boosts-gaming.ars?utm_source=microblogging&amp;utm_medium=arstch&amp;utm_term=Main%20Account&amp;utm_campaign=microblogging">Ars Technica</a> ha a writeup about CES.  <a href="http://www.pcmag.com/article2/0,2817,2357853,00.asp">PC Magazine</a> has a hands-on with the Palm Pre Plus and Pixi Plus.  <a href="http://www.aboutpalmpre.com/2010/01/09/some-thoughts-on-palms-ces-announcement-palm-pre-games-are-here-and-a-brilliant-developer-strategy/">About Palm Pre</a> has some interesting thoughts on Palm&#8217;s developer strategy that mirror our own.  And, of course, <a href="http://www.precentral.net/live-palms-ces-2010-event">PreCentral</a> has a lot of articles about CES.</p>
]]></content:encoded>
			<wfw:commentRss>http://pre101.com/blog/2010/01/09/palm-at-ces-2010-3d-video-pre-and-pixi-plus-and-more/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wednesday News Roundup &#8212; Troubled Waters</title>
		<link>http://pre101.com/blog/2009/12/09/wednesday-news-roundup-troubled-waters/</link>
		<comments>http://pre101.com/blog/2009/12/09/wednesday-news-roundup-troubled-waters/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 03:51:41 +0000</pubDate>
		<dc:creator>Pre101</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[webOS]]></category>

		<guid isPermaLink="false">http://pre101.com/blog/?p=694</guid>
		<description><![CDATA[Welcome to the Wednesday News Roundup. This week marks the first Roundup shared with our new friends over at webOSroundup. This week the big story is Palm&#8217;s new legal woes.  After that, we&#8217;ll cover some news for webOS developers.  Lastly, we&#8217;ll cover the good news in the Roundup. Troubled Waters for Palm Legally speaking, it [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_163" class="wp-caption alignleft" style="width: 190px"><img class="size-full wp-image-163 " style="margin-right: 10px;" title="newspaper_closeup_eclaire www.flickr.com/photos/colouredinks/" src="http://pre101.com/blog/wp-content/uploads/2009/07/newspaper_closeup_eclaire1.jpg" alt="newspaper_closeup_eclaire" width="180" height="240" /><p class="wp-caption-text">CC Photo by {eclaire}</p></div>
<p>Welcome to the Wednesday News Roundup.  This week marks the first Roundup shared with our new friends over at <a href="http://www.webosroundup.com">webOSroundup</a>.  This week the big story is Palm&#8217;s new legal woes.  After that, we&#8217;ll cover some news for webOS developers.  Lastly, we&#8217;ll cover the good news in the Roundup.</p>
<h3><span id="more-694"></span>Troubled Waters for Palm</h3>
<p>Legally speaking, it was a rough week for Palm:  Palm received notice of two pending lawsuits.  The first was filed by Artifex Software, a California based company that develops, among other things, muPDF, which Palm used in developing the PDF reader application included with webOS.  <a href="http://www.businesswire.com/portal/site/home/permalink/?ndmViewId=news_view&amp;newsId=20091203006412&amp;newsLang=en">Artifex claims</a> that Palm included their muPDF software without either purchasing a commercial license or complying with the terms of the GPL.  There is no indication that Artifex has approached Palm regarding this.  Palm acknowledges using the muPDF and has even <a href="http://opensource.palm.com/1.3.1/index.html">made available the changes</a> they have made to that and other Open Source projects.  The crux of the problem seems to be that Palm did not make their entire PDF application source available online.  Depending on how Palm is using the muPDF software Artifex may be correct that Palm has not fully complied with the GPL.  However, it seems like this is likely an oversight on Palm&#8217;s part and a strong-arm tactic on Artifex&#8217;s part.  Artifex is no doubt hoping to get some headlines and possibly coerce Palm into a commercial license.  Palm will not likely be able publicly to respond given that the suit has been filed.</p>
<p>Perhaps more troubling is the <a href="http://sprintconnection.kansascity.com/?q=node/1356">lawsuit seeking class-action status</a> against Palm and Sprint over the recent loss of information stored in users&#8217; Palm Profiles.  If you haven&#8217;t heard about it there is some information in <a href="http://www.precentral.net/palm-profiles-suffering-major-backup-failures">this PreCentral article</a>.  In short, Palm does not keep multiple backups of  information backed up to the cloud.  If the data on the phone becomes corrupted or the phone did not back up properly the data may be lost when replacing phones or upgrading the operating system.  For those who are concerned about data loss we recommend looking to third-party solutions for local backup, such as The Missing Sync (<a href="http://www.markspace.com/products/pre/windows/palm-pre-sync-overview.html?source=picker_pre_pc">PC</a> or <a href="http://www.markspace.com/products/pre/mac/palm-pre-sync-overview.html?source=picker_pre_mac">Mac</a>) or <a href="http://www.chapura.com/pm_standard_pre.php">Chapura PocketMirror</a> (PC only).</p>
<p>Although the data loss has apparently only affected a small number of people it can be devastating to lose any information.  Hopefully this push Palm towards developing a more robust system for protecting data stored on webOS devices.  We also hope it won&#8217;t unnecessarily line lawyers&#8217; pockets.</p>
<h3>Developers, Developers&#8230;  You get the idea</h3>
<p>Two stories from the past week bode well for webOS developers.  First, mobile ad company <a href="http://www.admob.com/">AdMob</a> (recently acquired by Google) has released an <a href="http://blog.admob.com/2009/12/03/new-open-source-sdk-for-palm-webos/">open-source SDK for webOS</a> developers who want to use the AdMob network.  AdMob is one of the largest players in the mobile ad space.  This will allow developers to more easily integrate ads, which should translate into more free applications (or, ad-supported trial versions of paid applications) in the App Catalog.  Second, mobile application development tool <a href="http://blogs.nitobi.com/ryan/index.php/2009/12/07/phonegap-palm-now-availableg/">PhoneGap announced support for webOS</a>.  PhoneGap is a cross-platform tool that leverages Web technologies (much like Mojo development itself) to create native apps for multiple devices.  This should lead even more developers to look at webOS as a platform for distributing applications.</p>
<h3>Roundup</h3>
<p>PC Magazine (They still print magazines?  Who knew?) selected the Palm Pre as the most innovative new platform in their list of <a href="http://www.pcmag.com/article2/0,2817,2356328,00.asp">Best Tech Products of 2009</a>.  It&#8217;s not surprising then, that Ellen DeGeneres gave away the webOS based Palm Pixi with the tech bundle she gave out on the first day of her <a href="http://ellen.warnerbros.com/2009/12/12days-of-giveaways-1203.php">12 Days of Giveaways</a> (see the video below).  Finally, if you&#8217;re interested in setting up Google Voice, PreCentral has an excellent article on <a href="http://www.precentral.net/how-get-visual-voicemail-your-pre-or-pixi-using-google-voice">setting up visual voicemail with webOS</a> using the service.  Did you hear about something we didn&#8217;t cover?  Have some comments?  Sound off in the comments below or hop over to our <a href="http://twitter.com/Pre101">twitter feed</a>.<br />
<object id="embed" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="316" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="mediaKey=6d23724a-9b46-4480-9418-9c479bb45a51&amp;image=http://wbads.vo.llnwd.net/o25/u/telepixtv/ellen/us/video/2009-12/03/120309_12days_still.jpg&amp;origin=embed" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://wbads.vo.llnwd.net/o25/u/telepixtv/ellen/us/video/player/embed.swf" /><param name="name" value="embed" /><param name="flashvars" value="mediaKey=6d23724a-9b46-4480-9418-9c479bb45a51&amp;image=http://wbads.vo.llnwd.net/o25/u/telepixtv/ellen/us/video/2009-12/03/120309_12days_still.jpg&amp;origin=embed" /><param name="allowfullscreen" value="true" /><embed id="embed" type="application/x-shockwave-flash" width="480" height="316" src="http://wbads.vo.llnwd.net/o25/u/telepixtv/ellen/us/video/player/embed.swf" name="embed" bgcolor="#ffffff" quality="high" flashvars="mediaKey=6d23724a-9b46-4480-9418-9c479bb45a51&amp;image=http://wbads.vo.llnwd.net/o25/u/telepixtv/ellen/us/video/2009-12/03/120309_12days_still.jpg&amp;origin=embed" allowfullscreen="true" allowscriptaccess="always" align="middle"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://pre101.com/blog/2009/12/09/wednesday-news-roundup-troubled-waters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Guide to CSS Transitions in webOS</title>
		<link>http://pre101.com/blog/2009/11/10/a-guide-to-css-transitions-in-webos/</link>
		<comments>http://pre101.com/blog/2009/11/10/a-guide-to-css-transitions-in-webos/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 14:03:45 +0000</pubDate>
		<dc:creator>Dan Kurtz</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[webOS]]></category>

		<guid isPermaLink="false">http://pre101.com/blog/?p=483</guid>
		<description><![CDATA[Bringing Styles Into the 4th Dimension In the old days, in order to make HTML look the way you wanted, you used more HTML. Every element had to be individually styled, using ribbons of FONT and CENTER and B tags. Then CSS came along and gave web developers the ability to group elements into classes [...]]]></description>
			<content:encoded><![CDATA[<h3>Bringing Styles Into the 4th Dimension</h3>
<p>In the old days, in order to make HTML look the way you wanted, you used more HTML. Every element had to be individually styled, using ribbons of <code>FONT</code> and <code>CENTER</code> and <code>B</code> tags. Then CSS came along and gave web developers the ability to group elements into classes with similar display characteristics. The world heaved a sigh of relief, and developers started making more complicated websites, confident that site styling would not get in the way of functionality.</p>
<p>Then JavaScript and AJAX became popular, and suddenly it became commonplace for elements to have their classes modified by JavaScript, based on the results of AJAX calls from the server. When an element&#8217;s class changes, it is updated instantaneously to reflect the styles associated with the new class. That&#8217;s fine for some stuff, but sometimes you want the transition between classes to be a bit more, um, classy. Let&#8217;s say your site has a login box that remains hidden on a page until a user clicks the &#8220;log in&#8221; link. If you switch the box&#8217;s style from <code>opacity: 0;</code> to <code>opacity: 1;</code>, it will appear right away by default. If you want it to fade in, you have to write a JavaScript function that increments the opacity bit by bit until it reaches 1, and you have to call that function at the same time as you change the class of the login box. If you have a bunch of login boxes on your site, you have to attach that transitional behavior to each one of them manually. Because CSS doesn&#8217;t have the concept of transitioning through time, animation-heavy websites are stuck in the same place that pre-CSS websites were before CSS came along.</p>
<p><strong>CSS transitions</strong> solve this problem by bringing styles into the 4th dimension. CSS transitions allow web developers to specify that if an element has its style modified, the browser should smoothly transition its appearance to the new style, rather than shifting it abruptly. They&#8217;ve been available in WebKit for <a href="http://webkit.org/blog/138/css-animation/">about two years now</a>, and <a href="http://blog.mozbox.org/post/2009/10/12/Some-new-demos">just appeared in Gecko</a> a few weeks ago. Since they&#8217;re not available in most browsers, webOS developers are among the privileged few who can take advantage of them. Here&#8217;s how.<br />
<span id="more-483"></span></p>
<h3>The Basics</h3>
<p>Suppose your login box is 300px wide and you want it to hide offscreen until a user clicks a link, at which point it should get the class <code>active</code> and appear onscreen.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loginbox</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-300px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loginbox</span><span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Here&#8217;s a version of that with transitions:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loginbox</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-300px</span><span style="color: #00AA00;">;</span>
  -webkit-transition-property<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
  -webkit-transition-duration<span style="color: #00AA00;">:</span> .5s<span style="color: #00AA00;">;</span>
  -webkit-transition-timing-function<span style="color: #00AA00;">:</span> ease-in<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loginbox</span><span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And here&#8217;s how it&#8217;d look if you wanted the box to fade in and slide in at the same time:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loginbox</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-300px</span>
  opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  -webkit-transition-property<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> opacity<span style="color: #00AA00;">;</span>
  -webkit-transition-duration<span style="color: #00AA00;">:</span> .5s .25s<span style="color: #00AA00;">;</span>
  -webkit-transition-timing-function<span style="color: #00AA00;">:</span> ease-in linear<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loginbox</span><span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Here&#8217;s a brief overview of the three <code>-webkit-transition</code> properties used above;</p>
<dl>
<dt>-webkit-transition-property</dt>
<dd>A space-seperated list of the properties that should be animated when they change. You should only use numerical properties. &#8220;top&#8221;, &#8220;width&#8221;, &#8220;border-width&#8221; and &#8220;opacity&#8221; work, but &#8220;display&#8221;, &#8220;text-decoration&#8221; and &#8220;list-style-type&#8221;, for instance, do not. If this property is omitted, all the properties of an element will be animated. This is probably not what you want.</dd>
<dt>-webkit-transition-duration</dt>
<dd>A space-seperated list of the durations of the transitions of the different objects. &#8220;s&#8221; stands for seconds. This is 0s by default, so you need to set it.</dd>
<dt>-webkit-transition-timing-function</dt>
<dd>From the <a href="http://www.w3.org/TR/css3-transitions/">W3C Working Draft</a>:</p>
<blockquote><p>The &#8216;transition-timing-function&#8217; property describes how the intermediate values used during a transition will be calculated. It allows for a transition to change speed over its duration.</p></blockquote>
<p>&#8220;ease-in&#8221; starts slowly and picks up speed at the end. &#8220;linear&#8221; keeps the same speed all the way through.</p>
</dd>
</dl>
<p>And here are some things that <em>aren&#8217;t</em> supported in webOS (as of 1.2.1), but probably will be eventually, since they are part of WebKit 4:</p>
<dl>
<dt>-webkit-transition-delay</dt>
<dd>Allows you to set a delay before the start of the animation.</dd>
<dt>Events</dt>
<dd>Currently, there&#8217;s no way respond when a transition animation finishes, and this is the main drawback of the CSS approach to transitions. WebKit 4 lets objects listen for animation events, which will let you string a bunch of animations together without needing to call setTimeout() to activate each part of the animation.</dd>
</dl>
<p>In addition to the reduced code clutter, CSS transitions can speed up your app, since they are run from native compiled code, rather than from interpreted JavaScript. Don&#8217;t expect miracles, though &#8212; I&#8217;ve found that webOS can only handle a few animations at one time before things get choppy, and the size and complexity of the elements being animated also makes a difference. I was unable to animate a 320&#215;480 image without choppiness. While there is no programmatic way to cancel the animations, they are smart enough to smoothly reverse themselves if an element&#8217;s properties change in the middle of a transition. If the <code>active</code> class is removed from our login box while it&#8217;s still sliding in, it will slide out starting from wherever it happens to be at the moment the class was removed.</p>
<p>For more on the basics of transitions, check out the <a href="http://www.w3.org/TR/css3-transitions/">W3C docs</a>, and keep in mind that all the properties should be prefixed with <code>-webkit-</code> in webOS.</p>
<h3>Advanced Tricks with <code>-webkit-transform</code></h3>
<p>There&#8217;s another advanced CSS property in webOS, called <strong><code>-webkit-transform</code></strong>, that, when combined with CSS transitions, allows for some neat stuff. <code>-webkit-transform</code> is&#8230;well, I think of it as a mini-CSS within CSS. It lets you apply transformations to an element after it&#8217;s been rendered. In webOS, The available transformations (to my knowledge) are translate, scale, rotate and skew. To scale an element to twice its height and rotate it 30 degress (something that&#8217;s been impossible in HTML until now!), do like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#myDiv</span> <span style="color: #00AA00;">&#123;</span>
  -webkit-transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>30deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>The crucial difference between scaling a div with <code>-webkit-transform</code> and scaling by manipulating its width and height is that <code>-webkit-transform</code> will scale (or skew or rotate) the entire rendered div and its children smoothly. For more on -webkit-transform, see <a href="http://www.the-art-of-web.com/css/css-animation/">this post at Art of Web</a>.</p>
<p>You can animate <code>-webkit-transform</code> by passing it to <code>-webkit-transition-property</code>. If you&#8217;re using a WebKit browser, hover over the card below to see an example.</p>
<p><img id="cardexample" src="/blog/wp-content/uploads/2009/11/cardback.jpeg" alt="" /><br clear="all" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#cardexample</span> <span style="color: #00AA00;">&#123;</span>
  -webkit-transition-property<span style="color: #00AA00;">:</span> -webkit-transform<span style="color: #00AA00;">;</span>
  -webkit-transition-duration<span style="color: #00AA00;">:</span> 1s<span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>0deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#cardexample</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  -webkit-transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>180deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Our games <a href="http://www.selfawaregames.com/wordace.html">Word Ace</a> and <a href="http://www.selfawaregames.com/cardace.html">Card Ace</a> use this technique for pretty much every animation in the game. It&#8217;s a lot of fun to describe the behavior of a class in CSS and have elements automatically move around when they&#8217;re changed. There were times when I&#8217;d forgotten that I had set transition properties on an element, and was surprised when it started moving around of its own accord.</p>
<h3>Caveats</h3>
<p>Advanced animations are tricky with CSS. For example, the timers in Word Ace and Card Ace use transitions. In order to start a timer countdown, the yellow timer bar gets two classes set: one to set the bar to &#8220;full&#8221;, and another that sets it to &#8220;empty&#8221; with a transition, so that the width of the bar decreases slowly. My first pass at the code was something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">// CSS
<span style="color: #cc00cc;">#timer-bar</span><span style="color: #6666ff;">.full</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">22px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
  -webkit-transition-property<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">;</span>
  -webkit-transition-duration<span style="color: #00AA00;">:</span> 10s<span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#timer-bar</span><span style="color: #6666ff;">.full</span><span style="color: #6666ff;">.counting-down</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">0</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// JavaScript</span>
<span style="color: #003366; font-weight: bold;">function</span> startTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> timerBar <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'timer-bar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  timerBar.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'full'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  timerBar.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'counting-down'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>It didn&#8217;t work. The timer bar never went to &#8220;full&#8221;. After some research, I discovered <a href="http://www.frozen-o.com/blog/2009/02/webkit-css-animation-behavior-weirdness.html">a blog post</a> explaining that changes to element styles are batched during an event, and are processed all at once after an event has finished, for performance reasons. In this case, WebKit sees that the classes I&#8217;m adding would set the element&#8217;s width twice, so it only bothers setting the second width &#8212; 0%. If you need to do a multi-step transition this way, you need to chunk the DOM manipulation into different events:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> startTimer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> timerBar <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'timer-bar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  timerBar.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'full'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    timerBar.<span style="color: #660066;">addClassName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'counting-down'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Tricky, huh? This also applies in cases where you need to set a hidden element to <code>display: block;</code> before you move it around.</p>
<h3>In Short&#8230;</h3>
<p>CSS transitions make our games smoother, more lively, and easier to maintain. They&#8217;re not without their pitfalls, but once you master the basics, they&#8217;re an easy, elegant way to add a bit of zest to your UI. For more information (not all of which applies to webOS, unfortunately), see the <a href="http://edr.euro.apple.com/safari/library/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Transitions/Transitions.html">Safari reference</a> and the <a href="http://www.w3.org/TR/css3-transitions/">W3C working spec</a>.</p>
<p><strong>Dan Kurtz is the webOS developer at <a href="http://selfawaregames.com">Self Aware Games</a>, makers of Word Ace and Card Ace for the Pre and Pixi. Both are online multiplayer card games that make extensive use of the advanced JavaScript and CSS techniques available in webOS.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://pre101.com/blog/2009/11/10/a-guide-to-css-transitions-in-webos/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

