<?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>GirlieMac! Blog &#187; Sandbox</title>
	<atom:link href="http://girliemac.com/blog/category/dev/sandbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://girliemac.com/blog</link>
	<description>Web and Mobile Development</description>
	<lastBuildDate>Tue, 27 Dec 2011 22:05:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Quick Fun: CSS3 Filter Effects</title>
		<link>http://girliemac.com/blog/2011/12/21/quick-fun-css3-filter-effects/</link>
		<comments>http://girliemac.com/blog/2011/12/21/quick-fun-css3-filter-effects/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 23:30:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=411</guid>
		<description><![CDATA[I quickly played with the brand-new CSS Filter Effects on the latest WebKit Nightly! (Edited: and Chrome Canary 18.0.976.0 +) Click the images to view in the [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2011%252F12%252F21%252Fquick-fun-css3-filter-effects%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fis.gd%2Fww3fYB%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Quick%20Fun%3A%20CSS3%20Filter%20Effects%22%20%7D);"></div>
<p>I quickly played with the brand-new <a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html" target="_blank">CSS Filter Effects</a> on the latest <a href="http://nightly.webkit.org" target="_blank">WebKit Nightly</a>! (Edited: and <a href="http://tools.google.com/dlpage/chromesxs" target="_blank">Chrome Canary</a> 18.0.976.0 +)</p>
<p>Click the images to view in the full size.</p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/default.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/default-300x235.png" alt="no filter" title="no filter" width="300" height="235" class="alignleft size-medium wp-image-412" /></a><br />
This is a default google.com screen.<br />
No filter added.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/blur-2px.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/blur-2px-300x235.png" alt="filter:blur(2px)" title="filter:blur(2px)" width="300" height="235" class="alignleft size-medium wp-image-413" /></a><br />
<strong>blur(radius)</strong> to create Gaussian blur</p>
<pre class="css">
-webkit-filter: blur(2px);
</pre>
<p>The default is 0, no blur.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/brightness-30.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/brightness-30-300x235.png" alt="filter:brightness(30%)" title="filter:brightness(30%)" width="300" height="235" class="alignleft size-medium wp-image-416" /></a><br />
<strong>brightness(amount)</strong></p>
<pre class="css">
-webkit-filter: brightness(30%);
</pre>
<p>The default is 100%. Values of amount over 100% are allowed.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/contrast-30.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/contrast-30-300x235.png" alt="filter:contrast(30%)" title="filter:contrast(30%)" width="300" height="235" class="alignleft size-medium wp-image-418" /></a><br />
<strong>contrast(amount)</strong></p>
<pre class="css">
-webkit-filter: contrast(30%);
</pre>
<p>The default is 100%. Values of amount over 100% are allowed.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/grayscale-100.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/grayscale-100-300x235.png" alt="filter:grayscale(100%)" title="filter:grayscale(100%)" width="300" height="235" class="alignleft size-medium wp-image-419" /></a><br />
<strong>grayscale(amount)</strong></p>
<pre class="css">
-webkit-filter: grayscale();
</pre>
<p>The default is 100%.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/sepia-100.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/sepia-100-300x235.png" alt="filter:sepia(100%)" title="filter:sepia(100%)" width="300" height="235" class="alignleft size-medium wp-image-420" /></a><br />
<strong>sepia(amount)</strong></p>
<pre class="css">
-webkit-filter: sepia();
</pre>
<p>The default is 100%.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/invert-100.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/invert-100-300x235.png" alt="filter:invert(100%)" title="filter:invert(100%)" width="300" height="235" class="alignleft size-medium wp-image-421" /></a><br />
<strong>invert(amount)</strong></p>
<pre class="css">
-webkit-filter: invert();
</pre>
<p>The default is 100%.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/opacity-30.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/opacity-30-300x235.png" alt="filter:opacity(30%)" title="filter:opacity(30%)" width="300" height="235" class="alignleft size-medium wp-image-422" /></a><br />
<strong>opacity(amount)</strong></p>
<pre class="css">
-webkit-filter: opacity(30%);
</pre>
<p>The default is 100%, no transparency.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/saturate-50.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/saturate-50-300x235.png" alt="filter:saturate(50%)" title="filter:saturate(50%)" width="300" height="235" class="alignleft size-medium wp-image-423" /></a><br />
<strong>Saturate(amount)</strong></p>
<pre class="css">
-webkit-filter: saturate(50%);
</pre>
<p>The default is 100%.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/saturate-300.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/saturate-300-300x235.png" alt="filter:saturate(300%)" title="filter:saturate(300%)" width="300" height="235" class="alignleft size-medium wp-image-436" /></a><br />
<strong>Saturate(amount)</strong> &#8211; the amount over 100% is also allowed.</p>
<pre class="css">
-webkit-filter: saturate(300%);
</pre>
<p><br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/hue-rorate-90deg.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/hue-rorate-90deg-300x235.png" alt="filter:hue-rotate(90deg)" title="filter:hue-rotate(90deg)" width="300" height="235" class="alignleft size-medium wp-image-424" /></a><br />
<strong>hue-rotate(angle)</strong></p>
<pre class="css">
-webkit-filter: hue-rotate(90deg);
</pre>
<p>The default is 0deg.<br />
<br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/hue-rorate-300deg.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/hue-rorate-300deg-300x235.png" alt="filter:hue-rotate(300deg)" title="filter:hue-rotate(300deg)" width="300" height="235" class="alignleft size-medium wp-image-425" /></a><br />
<strong>hue-rotate(angle)</strong></p>
<pre class="css">
-webkit-filter: hue-rotate(300deg);
</pre>
<p><br clear="all" /></p>
<p><a href="http://girliemac.com/blog/wp-content/uploads/2011/12/drop-shadown-on-toolbar.png"><img src="http://girliemac.com/blog/wp-content/uploads/2011/12/drop-shadown-on-toolbar-300x235.png" alt="filter:drop-shadow(...)" title="filter:drop-shadow(...)" width="300" height="235" class="alignleft size-medium wp-image-441" /></a><br />
<strong>drop-shadow(&lt;shadow&gt;)</strong></p>
<pre class="css">
/* Adding Drop-shadow on the toolbar at the top */

#bg {
  -webkit-filter: drop-shadow(rgba(0,0,0,0.5) 0 5px 5px);
}
</pre>
<p><br clear="all" /></p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2011/12/21/quick-fun-css3-filter-effects/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Quick Demo: CSS3 Fancy Avatar</title>
		<link>http://girliemac.com/blog/2011/02/17/quick-demo-css3-fancy-avatar/</link>
		<comments>http://girliemac.com/blog/2011/02/17/quick-demo-css3-fancy-avatar/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 06:27:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=225</guid>
		<description><![CDATA[Now I started using jsfiddle for code snippets so I can show the code AND the actual results on browsers. This fancy avatar frame is created pretty [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2011%252F02%252F17%252Fquick-demo-css3-fancy-avatar%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fis.gd%2Fvkqh04%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Quick%20Demo%3A%20CSS3%20Fancy%20Avatar%20%23css3%22%20%7D);"></div>
<p><img src="http://girliemac.com/blog/wp-content/uploads/2011/02/css3-avatar.png" alt="css3-avatar" title="css3-avatar" width="413" height="106" class="aligncenter size-full wp-image-227" /></p>
<p>Now I started using jsfiddle for code snippets so I can show the code AND the actual results on browsers.</p>
<p><iframe style="width: 100%; height: 260px" src="http://jsfiddle.net/girlie_mac/cQ99J/embedded/css,html,result"></iframe></p>
<p>This fancy avatar frame is created pretty easily by using CSS box-shadow inset values.<br />
Basically, what I did is that giving a div container (with an avatar picture as a background image) an inset shadow to bottom/right, and glare to top/left. Oh and added border-radius for the rounded corners.</p>
<p>This works without the vendor-specific extensions on latest Firefox, Chrome, Webkit Nightly, and Opera. Safari 5 still requires <code>-webkit</code> extension to make the box-shadow work.</p>
<p>Really easy and practical!</p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2011/02/17/quick-demo-css3-fancy-avatar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quick Demo: Webkit CSS3 Mask with SVG</title>
		<link>http://girliemac.com/blog/2010/09/20/201/</link>
		<comments>http://girliemac.com/blog/2010/09/20/201/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 00:27:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=201</guid>
		<description><![CDATA[I haven&#8217;t got a chance to create the apps and demos I&#8217;ve been thinking because my day job at Palm has kept me really busy. (Yeah, we&#8217;re [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2010%252F09%252F20%252F201%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fis.gd%2F19wIpL%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Quick%20Demo%3A%20Webkit%20CSS3%20Mask%20with%20SVG%20%23css3%20%23svg%22%20%7D);"></div>
<p>I haven&#8217;t got a chance to create the apps and demos I&#8217;ve been thinking because my day job at Palm has kept me really busy. (Yeah, we&#8217;re shipping webOS 2.0 pretty soon!)<br />
So instead of writing a new material, I decided to post the stuff I was testing around a while ago because SVG seems to be a hot topic since the HTML5 buzz!</p>
<p><img src="http://girliemac.com/blog/wp-content/images/svg-mask.png" align="right"/>This is an example of CSS mask with SVG. -The CSS alpha mask is introduced by <a href="http://webkit.org/blog/181/css-masks/" target="_blank">Webkit.org</a> back in 2008.</p>
<p>And this image at the right is a screen capture from WebKit Nightly browser. The photo I use here is a Twitter avatar photo of <a href="http://twitter.com/SOCKINGTON" target="_blank">@sockington</a>, masked with an <a href="http://girliemac.com/sandbox/svg/twitter-bird-new.svg">SVG file</a> (I used the vector image created by <a href="http://eagl0r.deviantart.com/#/d2yth6g" target="_blank">eagl0r</a> on DeviantArt and converted it as as SVG with Adobe Illustrator) with using Webkit-only CSS 3 property, <code style="font-weight:bold">-webkit-mask</code>.
</p>
<p>
<a href="http://girliemac.com/sandbox/mask.html" target="_blank">The actual demo is here.</a><br />
This works only on advanced webkit-browsers with SVG support, such as Safari 4+ and Chrome 2+ (not sure. I need to check). Android webkit browsers currently do not support SVG.<br />
For non-supporting browsers, you should just see three rectangle pictures as fallback. Nothing should look broken.
</p>
<h3>The code is Simple</h3>
<pre class="html">
<code>
&lt;img class="avatar" src="avatar-pic.png"/&gt;
</code>
</pre>
<pre class="css">
<code>
.avatar {
  -webkit-mask-box-image: url(twitter-bird.svg);
}
</code>
</pre>
<p>I used <code>mask-box-image</code> instead of <code>mask-image</code> to make the mask stretch to fit with various image sizes and aspect ratio. <code>mask-image</code> repeats the mask images as patterns (also you can specify the type of repeat, and position etc. I am not going to talk about them here but you can read on the reference link below).<br />
<h3>Reference</h3>
<p><strong>Surfin&#8217; Safari (webkit.org)</strong> &#8211; <a href="http://webkit.org/blog/181/css-masks/"  target="_blank"> CSS Masks</a></p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2010/09/20/201/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simulating MacOS Dock-like menu with CSS3</title>
		<link>http://girliemac.com/blog/2010/06/02/simulating-macos-dock-like-menu-with-css3/</link>
		<comments>http://girliemac.com/blog/2010/06/02/simulating-macos-dock-like-menu-with-css3/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 06:14:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=173</guid>
		<description><![CDATA[Since my original &#8220;CSS Aqua button&#8221; written last year, I have seen more and more fan CSS3 UI mimic of MacOS components around! I think I have [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2010%252F06%252F02%252Fsimulating-macos-dock-like-menu-with-css3%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Simulating%20MacOS%20Dock-like%20menu%20with%20CSS3%22%20%7D);"></div>
<p><img src="http://girliemac.com/blog/wp-content/images/dock-screenshot.jpg" alt="css3 Dock screenshot"/></p>
<p>
Since my original &#8220;CSS Aqua button&#8221; written last year, I have seen more and more fan CSS3 UI mimic of MacOS components around! I think I have seen some Mac docks too, but as I remember they all use jQuery.<br />
So I was thinking about making one only with CSS.
</p>
<p>Initially I thought it was easy &#8211; let&#8217;s make an hovered icon larger like 200%, and make siblings in 150% of the original size using CSS sibling selector, and done! A piece of cake, huh? &#8211; Then I realized I made a mistake. The adjacent-sibling selector apply to an element which is immediately <em>after</em> the element in markup, not both before and after.<br />
Oh well, so I needed to write a minimal JavaScript (so you don&#8217;t need to import a whole JS library) to add a class name to the element comes before the hovered object.</p>
<p>Anyway, here&#8217;s the <a href="http://girliemac.com/sandbox/dock.html" target="_blank">live-demo!</a> (Try it with the the latest Webkit Nightly or Safari 4) for the best experience!), and I&#8217;ll show you how I did-
</p>
<h3>Markup (Simplified)</h3>
<p>Let&#8217;s create menu items as a list.</p>
<pre class="html">
<code>
&lt;div id="dock-container"&gt;
  &lt;div id="dock"&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href="http://android.com"&gt;&lt;img src="images/dock-icons/android.png"/>&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://palm.com"&gt;&lt;img src="images/dock-icons/palm.png"/&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;...
  &lt;/ul&gt;
  &lt;div class="base"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code>
</pre>
<p>The list should be displayed horizontally by setting the style to <code>#dock li {display:inline-block}</code>. Please see the source code from the demo for the details.
</p>
<h3>Magnify the icon with CSS transform</h3>
<p>
<img style="border:1px solid #666;" src="http://girliemac.com/blog/wp-content/images/dock-tutorial.png" align="right"/>First, let&#8217;s define the dock icon animation with css transition.<br />
The origin of the transform has to set to bottom, so the icon doesn&#8217;t scale from the middle of the icon. (Diagram #1).</p>
<p>I used only a webkit extension for this example but you can use <code>-moz</code> and <code>-o</code> extensions, for Firefox and Opera respectively.</p>
<p>Then, set the hover state &#8211; use css transform to scale the icon image up to 200%. Also you need to add some margin otherwise the enlarged icon overlaps with neighboring icons!
</p>
<pre class="css">
<code>
#dock li img {
  width: 64px;
  height: 64px;
  -webkit-box-reflect: below 2px
		    -webkit-gradient(linear, left top, left bottom, from(transparent),
		    color-stop(0.7, transparent), to(rgba(255,255,255,.5))); /* reflection is supported by webkit only */
  -webkit-transition: all 0.3s;
  -webkit-transform-origin: 50% 100%;
}
#dock li:hover img {
  -webkit-transform: scale(2);
  margin: 0 2em;
}
</code>
</pre>
<h3>Magnify adjacent icons</h3>
<pre class="css">
<code>
#dock li:hover + li img,
#dock li.prev img {
  -webkit-transform: scale(1.5);
  margin: 0 1.5em;
}
</code>
</pre>
<p>To magnify the icon at the right hand side of the hovered icon (Diagram #2), all you need to do is define the scale with using a CSS adjacent-sibling selector, E + F (an F element immediately preceded by an E element).</p>
<p>For the icon at the left (Diagram #3), ss I mentioned earlier, there is no css to get the <em>previous</em> sibling, so I need to rely on JavaScript.<br />
I used the DOM node interface, <code>previousElementSibling</code> to access the sibling node. <code>previousElementSibling</code> should be supported by Webkit, Opera and Firefox.</p>
<p>Basically what I am doing here is that get the mouseovered object (should be an img element), find the parent li element (the immediate parent should be an a-alement, not a li, so get a&#8217;s parent! Check the HTML code again!), find the previous sibling li, then give a classname &#8220;prev&#8221; so I can apply the style.<br />
Don&#8217;t forget to remove the class name as mouseout, otherwise the icon stays large.
</p>
<pre class="js">
<code>
function addPrevClass (e) {
  var target = e.target;
    if(target.getAttribute('src')) { // check if it is img
      var li = target.parentNode.parentNode;
      var prevLi = li.previousElementSibling;
      if(prevLi) {
        prevLi.className = 'prev';
      }

      target.addEventListener('mouseout', function() {
        prevLi.removeAttribute('class');
      }, false);
  }
}
if (window.addEventListener) {
  document.getElementById("dock").addEventListener('mouseover', addPrevClass, false);
}
</code>
</pre>
<p>For more details with the fancy CSS3 effects (e.g. the gradient and 3D-transform to create the &#8220;base&#8221; of the dock), please see the source code of the <a href="http://girliemac.com/sandbox/dock.html" target="_blank">demo page!</a></p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2010/06/02/simulating-macos-dock-like-menu-with-css3/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>CSS3 Box-Shadow with Inset Values &#8211; The Aqua Button ReReVisited!</title>
		<link>http://girliemac.com/blog/2010/02/04/css3-box-shadow-with-inset-values-the-aqua-button-rerevisited/</link>
		<comments>http://girliemac.com/blog/2010/02/04/css3-box-shadow-with-inset-values-the-aqua-button-rerevisited/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 05:22:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=151</guid>
		<description><![CDATA[This is my third article on CSS3 No Image Aqua Buttons. The previous articles include: CSS3 Gradients: No Image Aqua Button CSS3 Aqua Button – Revisited for [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2010%252F02%252F04%252Fcss3-box-shadow-with-inset-values-the-aqua-button-rerevisited%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22CSS3%20Box-Shadow%20with%20Inset%20Values%20-%20The%20Aqua%20Button%20ReReVisited%21%20%22%20%7D);"></div>
<p><a href="http://girliemac.com/sandbox/button.html"><img alt="Screenshot ot CSS Aqua buttons" src="http://girliemac.com/blog/wp-content/images/screenshot_css3button_2.png" title="Screenshot" width="224" height="135" align="right" /></a></p>
<p>This is my third article on CSS3 No Image Aqua Buttons. The previous articles include:</p>
<ol>
<li><a href="http://girliemac.com/blog/2009/04/30/css3-gradients-no-image-aqua-button/" target="_blank">CSS3 Gradients: No Image Aqua Button</a></li>
<li><a href="http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/" target="_blank">CSS3 Aqua Button – Revisited for Firefox 3.6</a></li>
<li>And this one &#8211; Read on!</li>
</ol>
<p>Since Smashing Magazine has selected the original Aqua button demo for their article, <a href="http://www.smashingmagazine.com/2010/02/01/50-brilliant-css3-javascript-coding-techniques/" target="_blank">&#8220;50 Brilliant CSS3/JavaScript Coding Techniques&#8221;</a>, I have had so much more visitors to my blog. </p>
<p>This resulted quality developers leave useful comments and tips for me &#8211; thank you, <a href="http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/#comment-1411" target="_blank">Zoley</a> for suggesting using <code>box-shadow</code> with the <em>inset</em> value, and a big thank you to <a href="http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/#comment-1428" target="_blank">Jim</a> for actually re-writing the Aqua button with the technique!!!</p>
<p>So, now the CSS3 Aqua button is revised with semantic markup (no more &#8220;glare&#8221; div! Yes, I complained it by myself before!) and shorter CSS.<br />
And this time, no CSS gradients! &#8211; use CSS <code>box-shadow</code> property with multiple <em>inset</em> values to draw layers of inner-shadows to create the visual effect.</p>
<h3>Syntax</h3>
<p><code>(-moz-)box-shadow:  none | &lt;shadow&gt; [,&lt;shadow&gt;]*    where &lt;shadow&gt; is defined as:  inset? &#038;&#038; [ &lt;offset-x&gt; &lt;offset-y&gt; &lt;blur-radius&gt;? &lt;spread-radius&gt;? &#038;&#038; &lt;color&gt;? ]<br />
</code></p>
<h3>Values</h3>
<p>from <a href="https://developer.mozilla.org/en/CSS/-moz-box-shadow" target="_blank">Mozilla Developer Center</a>:</p>
<blockquote><p>
<strong>inset (optional)</strong><br />
If not specified (default), the shadow is assumed to be a drop shadow (as if the box were raised above the content).<br />
The presence of the <code>inset</code> keyword changes the shadow to one inside the frame (as if the content was depressed inside the box). Inset shadows are drawn above background, but below border and content.<br/><br />
<strong>&lt;color&gt; (optional)</strong><br />
If not specified, the color depends on the browser. In Gecko (Firefox), the value of the <code>color</code> property is used. Safari&#8217;s shadow is transparent and therefore useless if &lt;color&gt; is omitted.<br/><br />
<strong>&lt;offset-x&gt; &lt;offset-y&gt; (required)</strong><br />
This are two &lt;length&gt; values to set the shadow offset. &lt;offset-x&gt; specifies the horizontal distance. Negative values place the shadow to the left of the element. &lt;offset-y&gt; specifies the vertical distance. Negative values place the shadow above the element.<br />
If both values are 0, the shadow is placed behind the element (and may generate a blur effect if &lt;blur-radius&gt; and/or &lt;spread-radius&gt; is set).<br/><br />
<strong>&lt;blur-radius&gt; (optional)</strong><br />
This is a third &lt;length&gt; value. The higher this value, the bigger the blur, so the shadow becomes bigger and lighter. If not specified, it will be 0.<br/><br />
<strong>&lt;spread-radius&gt; (optional)</strong><br />
This is a fourth &lt;length&gt; value. Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. If not specified, it will be 0 (the shadow will be the same size as the element).<br />
<strong></strong><br/>
</p></blockquote>
<p>Note &#8211; The <code>box-shadow</code> property has been removed from <a href="http://www.w3.org/TR/css3-background/#the-box-shadow" target="_blank">W3C CSS3 Background</a> Candidate recommendation document.</p>
<h3>The Entire Code!</h3>
<p>Use <code>-moz</code> and <code>-webkit</code> prefix for <code>box-shodow</code> to support these browsers. For Opera, there&#8217;s no need to add <code>-o</code>.</p>
<p>Also, notice there are three <code>inset</code> values are defined for detailed visual effects!</p>
<pre class="html">
<code>
&lt;input type="button" class="new-aqua" value="Login"/&gt;
</code>
</pre>
<pre class="css">
<code>
input[type=button].new-aqua {
  width: 155px;
  height: 35px;
  background: #cde;
  border: 2px solid #ccc;
  border-color: #8ba2c1 #5890bf #4f93ca #768fa5;
  font: 600 16px/1 Lucida Sans, Verdana, sans-serif;
  color: #fff;
  text-shadow: rgba(10, 10, 10, 0.5) 1px 2px 2px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  border-radius: 16px; -moz-border-radius: 16px; -webkit-border-radius: 16px;
  box-shadow: 0 10px 16px rgba(66, 140, 240, 0.5), inset 0 -8px 12px 0 #6bf, inset 0 -8px 0 8px #48c, inset 0 -35px 15px -10px #7ad;
  -moz-box-shadow: 0 10px 16px rgba(66, 140, 240, 0.5), inset 0 -8px 12px 0 #6bf, inset 0 -8px 0 8px #48c, inset 0 -35px 15px -10px #7ad;
  -webkit-box-shadow: 0 10px 16px rgba(66, 140, 240, 0.5), inset 0 -8px 12px 0 #6bf, inset 0 -8px 0 8px #48c, inset 0 -35px 15px -10px #7ad;
}
.new-aqua:hover {
  text-shadow: rgb(255, 255, 255) 0px 0px 5px;
}
</code>
</pre>
<p><br/></p>
<p>View the <a href="http://girliemac.com/sandbox/button.html" target="_blank">live demo page</a>! This new aqua button works on FF 3.6, Webkit 4 (the current Safari 4 doesn&#8217;t support inset box-shadow yet), Chrome 4 and Opera 10. (But fails on 10.1 on Mac).</p>
<p style="color:#777"><em>* Edited on Feb.5 &#8211; Opera 10.1 fail and Safari4 (I noticed this works only on Webkit Nightly after published this!)</em></p>
<p>And again, a huge thanks to <a href="www.coroflot.com/trickitty" target="_blank">Jim Green</a> for the revised CSS!</p>
<h3>References</h3>
<ul style="margin-top:1em">
<li><a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html" target="_blank">Safari CSS Reference</a> by Apple Safari Dev Center</li>
<li><a href="https://developer.mozilla.org/en/CSS/-moz-box-shadow" target="_blank">-moz-box-shadow</a> by Mozilla Developer Center</li>
<li><a href="http://dev.opera.com/articles/view/css3-border-background-boxshadow/" target="_blank">CSS3 borders, backgrounds and box-shadows</a> by Dev.Opera</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2010/02/04/css3-box-shadow-with-inset-values-the-aqua-button-rerevisited/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>CSS3 Aqua Button &#8211; Revisited for Firefox 3.6</title>
		<link>http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/</link>
		<comments>http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:17:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Sandbox]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/?p=129</guid>
		<description><![CDATA[This is an update for the Aqua button tutorial. This update will add a support for Firefox 3.6. If you haven&#8217;t seen the article, please go read [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2010%252F01%252F28%252Fcss3-aqua-button-revisited-for-firefox-3-6%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22CSS3%20Aqua%20Button%20-%20Revisited%20for%20Firefox%203.6%22%20%7D);"></div>
<p>This is an update for the <a href="http://girliemac.com/blog/2009/04/30/css3-gradients-no-image-aqua-button/">Aqua button tutorial</a>. This update will add a support for Firefox 3.6. If you haven&#8217;t seen the article, please go read it before proceeding here.</p>
<p><br/></p>
<p>
<a href="http://girliemac.com/sandbox/button.html"><img alt="Screenshot ot CSS Aqua buttons" src="http://girliemac.com/blog/wp-content/images/screenshot_css3button_new.png" title="Screenshot" width="224" height="135" align="right" /></a></p>
<p>On the end of November last year, <a href="http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/" target="_blank">Mozilla Hacks announced</a> the support for CSS gradient in a background on upcoming Firefox 3.6 (which final version has just released recently). </p>
<p>As already been supported on WebKit, FF does support both linear and radial gradient, however, Mozilla has implemented differently &#8211;<br />
Most noticeably, Mozilla separate linear and radial gradient as <code>-moz-linear-gradient</code> and <code>-moz-radial-gradient</code>, while on WebKit, the syntax goes <code>-webkit-gradient</code> and you specify linear or radial.</p>
<p>Also the specification of each value is different too.<br />
If you want a linear gradient starting from red on top to ending at bottom in white, you need to define &#8211; </p>
<p>WebKit:<br />
<code>background: -webkit-gradient(linear, left top, right bottom, from(red), to(white)))</code><br />
Firefox:<br />
<code>background: -moz-linear-gradient(top, red, white);<br />
</code>
</p>
<h3>The Aqua Button Redefined</h3>
<p>Let&#8217;s re-create the aqua button, by adding <code>-moz</code> prefixed gradient definitions:</p>
<p>The button:</p>
<pre class="css">
<code>
.aqua{
  background-color: rgba(60, 132, 198, 0.8);
  border-top-color: #8ba2c1;
  border-right-color: #5890bf;
  border-bottom-color: #4f93ca;
  border-left-color: #768fa5;
  -webkit-box-shadow: rgba(66, 140, 240, 0.5) 0px 10px 16px;
  -moz-box-shadow: rgba(66, 140, 240, 0.5) 0px 10px 16px;
  background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(rgba(28, 91, 155, 0.8)), to(rgba(108, 191, 255, .9)));
/* for FF 3.6 */
  background-image: -moz-linear-gradient(rgba(28, 91, 155, 0.8) 0%, rgba(108, 191, 255, .9) 90%);
}
</code>
</pre>
<p>and the glare:</p>
<pre class="css">
<code>
.button .glare {
  position: absolute;
  top: 0;
  left: 5px;
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  height: 1px;
  width: 142px;
  padding: 8px 0;
  background-color: rgba(255, 255, 255, 0.25);
  background-image: -webkit-gradient(linear, 0% 0%, 0% 95%, from(rgba(255, 255, 255, 0.7)), to(rgba(255, 255, 255, 0)));
  /* for FF 3.6 */
  background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 95%);
}
</code>
</pre>
<p>This is <a href="http://girliemac.com/sandbox/button.html" target="_blank">the actual html page</a>. Open it on Firefox 3.6 and see!</p>
<h3>More Info on Mozilla CSS Gradients</h3>
<ul style="margin-top:1em">
<li><a href="http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/" target="_blank">CSS gradients in Firefox 3.6</a> by HACKS.MOZILLA.ORG</li>
<li><a href="https://developer.mozilla.org/index.php?title=en/CSS/-moz-linear-gradient" target="_blank">-moz-linear-gradient</a> by Mozilla Developer Center</li>
<li><a href="https://developer.mozilla.org/index.php?title=en/CSS/-moz-radial-gradient" target="_blank">-moz-radial-gradient</a> by Mozilla Developer Center</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2010/01/28/css3-aqua-button-revisited-for-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Webkit CSS 3D + Local DB Demo</title>
		<link>http://girliemac.com/blog/2009/09/03/webkit-css-3d-local-db-demo/</link>
		<comments>http://girliemac.com/blog/2009/09/03/webkit-css-3d-local-db-demo/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 06:37:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/2009/09/03/webkit-css-3d-local-db-demo/</guid>
		<description><![CDATA[Ever since I heard of Snow Loepard&#8217;s hardware-accelerated CSS, I wanted try some cool CSS animation for Safari 4. So after installing Snow Leopard, I spent about [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2009%252F09%252F03%252Fwebkit-css-3d-local-db-demo%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Webkit%20CSS%203D%20%2B%20Local%20DB%20Demo%22%20%7D);"></div>
<p><img src="http://girliemac.com/blog/wp-content/images/css3d.jpg" alt="css 3D screenshot"/></p>
<p>Ever since I heard of Snow Loepard&#8217;s hardware-accelerated CSS, I wanted try some cool CSS animation for Safari 4.</p>
<p>So after installing Snow Leopard, I spent about a day and half to try creating my first 3D animation with Flickr API.<br />
Honestly, I wasn&#8217;t sure where to get started to make some cool 3D effect, so what I did was I tried to reproduce the one on webkit.org example and modify a lot by trial and error approach.<br />
Also, I have been freqently asked about how I did with &#8220;My Favorites&#8221; feature on <a href="http://girliemac.com/blog/2009/08/29/pretty-cute-suite-another-cute-app-for-pre-from-me/">my Palm Pre app</a> (which is also a WebKit-based), so I throw the HTML5&#8242;s local storage demo with this 3D demo.
</p>
<p>So here, you can try my <a href="http://girliemac.com/sandbox/flickr_3d.html" target="_blank">CSS 3D and Local DB Demo</a>!!!<br />
Be sure to view this demo on Safari 4, iPhone Safari, or WebKit Nightly! This doesn;t seem to work on other Webkit-based browsers such as Chrome and Palm.
</p>
<p>I am not going to write a whole tutorial how to replicate this animation but I try to explain some examples.</p>
<h3>Spin a Wheel!</h3>
<p>Look at one of the flicke photo wheel on my demo. This is a combination of a few different animation.<br />
Let&#8217;s focus on the small wheel inside. This is the snippet of HTML of the wheel:</p>
<pre class="html">
<code>

&lt;div id="gallery"&gt;
  &lt;div id="pic01"&gt;&lt;img src="..."/&gt;&lt;/div&gt;
  &lt;div id="pic02"&gt;&lt;img src="..."/&gt;&lt;/div&gt;
  ... (10 more imgs)
&lt;/div&gt;	

</code>
</pre>
<p><img src="http://girliemac.com/blog/wp-content/images/coordinate.png" alt="3D Cood" align="left"/><br />
OK, for now, let&#8217;s ignore how each photo is rendered to form a loop, and just focus on the animation of one div, #gallery (= a wheel). A band of photos is ratating clockwise around Y-axis.<br />
This means the animation starts as <code>-webkit-transform: rotateY(0);</code> and goes around an circle for a whole 360 degree. <code> -webkit-transform: rotateY(-360deg);</code>.<br />
Use positive if you want to rotate in opposite direction.<br />
I set the whole circle completion span as 60 seconds in linier motion and the animation goes infinite. </p>
<p>This diagram from <a href="http://developer.apple.com/safari/library/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Transforms/Transforms.html" target="_blank">Apple&#8217;s Safari Reference Library</a> explains coordinates.</p>
<p>So the css for this movement is defined as:</p>
<pre class="css">
<code>
#gallery {
  -webkit-transform-style: preserve-3d;
  -webkit-animation: spinY 60s linear infinite;
}
</code>
</pre>
<pre class="css">
<code>
@-webkit-keyframes spinY {
  from { -webkit-transform: rotateY(0);}
  to   { -webkit-transform: rotateY(-360deg);}
}
</code>
</pre>
<p>Use 3D style, <code>-webkit-transform-style: preserve-3d;</code>to give 3D illusion. I set the initial perspective in its parent div as <code>-webkit-perspective: 380;</code>.<br />
It gives you an illusion of the depth. You can make the value lower to make it look more up-close to you.<br />
The unit of perspective should be &#8220;px&#8221;, but it looks like you&#8217;d better remove it for iPhone.</p>
<p><img src="http://girliemac.com/blog/wp-content/images/css3d_pers200.png" alt="perspective 200"/> <img src="http://girliemac.com/blog/wp-content/images/css3d_pers400.png" alt="perspective 400"/><br />
<img src="http://girliemac.com/blog/wp-content/images/css3d_pers500.png" alt="perspective 500"/> <img src="http://girliemac.com/blog/wp-content/images/css3d_pers0.png" alt="perspective 0"/></p>
<p>To figure out how to render each photo in loop, also other animations, please look at the source code of my demo.</p>
<p>Also, I will write about how to use HTML 5&#8242;s local storage sometimes later!</p>
<h3>References</h3>
<ul>
<li><a href="http://webkit.org/blog/386/3d-transforms/" target="_blank">3D Transforms</a> by Webkit.org</li>
<li><a href="http://webkit.org/blog/130/css-transforms/" target="_blank">CSS Transforms (2D)</a> by Webkit.org</li>
<li><a href="http://webkit.org/blog/138/css-animation/" target="_blank">CSS Animation</a> by Webkit.org</li>
<li><a href="http://www.w3.org/TR/css3-3d-transforms/" target="_blank">CSS 3D Transforms Module Level 3</a> W3C Working Draft</li>
<li><a href="http://developer.apple.com/safari/library/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Transforms/Transforms.html" target="_blank">Safari Reference Library -Transforms</a> by Apple</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2009/09/03/webkit-css-3d-local-db-demo/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Find Your Tweeting Neighbor on iPhone with GeoLocation</title>
		<link>http://girliemac.com/blog/2009/06/21/find-your-tweeting-neighbor-on-iphone-with-geolocation/</link>
		<comments>http://girliemac.com/blog/2009/06/21/find-your-tweeting-neighbor-on-iphone-with-geolocation/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 02:20:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/2009/06/21/find-your-tweeting-neighbor-on-iphone-with-geolocation/</guid>
		<description><![CDATA[iPhone OS 3.0 is now available, and developers can take advantage of the newly introduced geolocation feature in Safari browser. To try it out quickly, I used [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2009%252F06%252F21%252Ffind-your-tweeting-neighbor-on-iphone-with-geolocation%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Find%20Your%20Tweeting%20Neighbor%20on%20iPhone%20with%20GeoLocation%22%20%7D);"></div>
<p><img src="http://girliemac.com/blog/wp-content/images/neighbortweet.png" alt="screenshot"/></p>
<p>iPhone OS 3.0 is now available, and developers can take advantage of the newly introduced <strong>geolocation</strong> feature in Safari browser.</p>
<p>To try it out quickly, I used Twitter Search API again to create a tiny test app called, <a href="http://girliemac.com/geo" target="_blank"/>NeighborTweet</a>, which enable you to find out who are tweeting in your neighborhood. Basically, what it does is that obtain your location, and pass the latitude and longitude data to Twitter search and display the result tweets.</p>
<p>Try it out on your iPhone with:<br />
Short URL <a href="http://girliemac.com/geo" target="_blank"/>http://bit.ly/K0ZaE</a><br />
or<br />
<a href=http://qrcode.kaywa.com/img.php?s=8&#038;d=http%3A%2F%2Fgirliemac.com%2Fgeo">This QR Code</a> with scanning app like BeeTagg.</p>
<p>If you are interested in learning more on Twitter search API and geocode, please read <a href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search" target="_blank">Twitter Wiki</a>.</p>
<p>OK, now here&#8217;s the code.<br />
To find out your location with Geolocation class is simple &#8211; you just call <code>getCurrentPosition()</code> method. This initiates an asynchronous request to detect the user&#8217;s position.</p>
<pre class="js">
<code>
navigator.geolocation.getCurrentPosition(someFunction)
</code>
</pre>
<p>Get latitude and longitude, by using <code>coords</code> instance:</p>
<pre class="js">
<code>
latitude = position.coords.latitude;
longitude = position.coords.longitude;
</code>
</pre>
<p>Here&#8217;s an actual code I used to create the sample app:</p>
<pre class="js">
<code>
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function(position) {
    callback(position.coords.latitude, position.coords.longitude);
  });
} else {
  alert("Geolocation services are not supported by your browser.");
} 

function callback(lat,lon){
  // twitter search json-p callback
  var geocode = "&#038;geocode=" + lat + "%2C" + lon + "%2C1mi";
  var fullUrl = url + geocode;
  ...
}
var url = "http://search.twitter.com/search.json?callback=getTweets";

function getTweets (json) {
  // display json data
  ...
}
</code>
</pre>
<h3>References</h3>
<p>Geolocation References:</p>
<ul>
<li><a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/GettingGeographicalLocations/GettingGeographicalLocations.html" target="_blank">Safari Reference Library &#8211; Getting Geographic Locations</a> &#8211; Apple Developer Connection</li>
<li><a href="https://developer.mozilla.org/En/Using_geolocation" target="_blank">Using geolocation</a> &#8211; Mozilla Developer Center</li>
<li><a href="http://www.w3.org/TR/geolocation-API/" target="_blank">Geolocation API Specification</a> &#8211; W3C Working Draft</li>
</ul>
<p>More References:</p>
<ul>
<li><a href="http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search" target="_blank">Twitter Search API Wiki</a></li>
<li><a href="http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/" target="_blank">Remote JSON &#8211; JSONP</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2009/06/21/find-your-tweeting-neighbor-on-iphone-with-geolocation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TweetTrendDunno &#8211; Played with APIs</title>
		<link>http://girliemac.com/blog/2009/06/16/tweettrenddunno-played-with-apis/</link>
		<comments>http://girliemac.com/blog/2009/06/16/tweettrenddunno-played-with-apis/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 05:20:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[App]]></category>
		<category><![CDATA[GirlieMac! News]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/2009/06/16/tweettrenddunno-played-with-apis/</guid>
		<description><![CDATA[I had a plenty of time to stay home and play with code right now so I mashed Twitter trend API, mixed with some BOSS news and [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2009%252F06%252F16%252Ftweettrenddunno-played-with-apis%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22TweetTrendDunno%20-%20Played%20with%20APIs%22%20%7D);"></div>
<p><img src="http://girliemac.com/blog/wp-content/images/tweettrend.png" alt="TweetTrendDunno screenshot" /><br />
I had a plenty of time to stay home and play with code right now so I mashed Twitter trend API, mixed with some BOSS news and image search stuff I used before, also Microsoft&#8217;s new Bing search results to create some silly and handy web app called <a href="http://girliemac.com/tweetNews/">TweetTrendDunno</a>.</p>
<p>Basically, this grabs Twitter &#8220;trending topic&#8221; terms, and as a user click on each term you want to know about, it displays news articles, images, and Bing results (usually summary from Wikipedia helps you to figure out what the term means in general).</p>
<p>If you are Twitter user and ever wonder what people are talking about, give <a href="http://girliemac.com/tweetNews/">TweetTrendDunno</a> a try!</p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2009/06/16/tweettrenddunno-played-with-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Matrix Animation with WebKit CSS3</title>
		<link>http://girliemac.com/blog/2009/05/03/matrix-animation-with-webkit-css3/</link>
		<comments>http://girliemac.com/blog/2009/05/03/matrix-animation-with-webkit-css3/#comments</comments>
		<pubDate>Mon, 04 May 2009 05:40:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Sandbox]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://girliemac.com/blog/2009/05/03/matrix-animation-with-webkit-css3/</guid>
		<description><![CDATA[I tweaked the WebKit CSS3 Animation example I made last time to create this &#8220;Matrix&#8221; animation for fun. This is the screen capture of the animation on [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_jade" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fgirliemac.com%252Fblog%252F2009%252F05%252F03%252Fmatrix-animation-with-webkit-css3%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Matrix%20Animation%20with%20WebKit%20CSS3%20%22%20%7D);"></div>
<p>
I tweaked <a href="http://girliemac.com/blog/2009/02/18/using-keyframes-webkit-css-animation-examples/">the WebKit CSS3 Animation example I made last time</a> to create this &#8220;Matrix&#8221; animation for fun.
</p>
<p>
This is the screen capture of the animation on Safari 4.<br />
<img src="http://girliemac.com/blog/wp-content/images/screenshot_css3matrix.png" alt="css3 animation screenshot"/></p>
<p>You can try<br />
<a href="http://girliemac.com/sandbox/matrix.html" target="_blank">the actual HTML page</a> and see it working on current WebKit Nightly build or Safari 4.
</p>
<p>To display the Katakana characters, I used <code>@font-face</code> rule to embed a Katakana dingbat-like font, rather than using an actual Japanese input.<br />
Although I wanted display the kanakana vertically with using <code>writing-mode: tb-rl</code>, which I believe has been proposed for CSS2, this is not supported on Webkit so I had to use <code>-webkit-transform</code> to rotate each div to 90 degree to display vertically.<br />
This way, each letter faces 90 deg angle too, but oh well, this Japanese letters are random, used only for visual purpose and don&#8217;t mean anything so I guess this doesn&#8217;t matter for now.
</p>
<p>Let&#8217;s take a look at some of the CSS3 code, I am showing only important parts so if you would like to view the entire code, just open up the htmlpage and use Webkit&#8217;s inspector!</p>
<h3>Embed A Katakana Font</h3>
<pre class="css">
<code>
@font-face {
  font-family: Katakana;
  src: url('MoonBeams-katakana_.TTF');
}

#matrix{
  font-family: Katakana; /* use the embedded font */
  position: absolute;
  ... (more styles here) ...
}
</code>
</pre>
<p>@font-face rule is not supported by older Safari including iPhone.<br />
On supported browsers, you should be able to use either TrueType (.ttf) or OpenType (.otf).
</p>
<h3>Define Animations</h3>
<pre class="css">
<code>
@-webkit-keyframes fade{
    0%   {opacity: 1;}
    100% {opacity: 0;}
}
@-webkit-keyframes fall{
   	from {top: -250px;}
	to 	{top: 300px;}
}
</code>
</pre>
<p>I used both <em>%</em> and <em>from/to</em> keywords. But with %, you can define in-between state.</p>
<h3>Rotate the Katakana Strings</h3>
<pre class="css">
<code>
#matrix div{
  position: absolute;
  top: 0;
  -webkit-transform-origin: 0%;
  -webkit-transform: rotate(90deg);
  ...
</code>
</pre>
<p>By setting <code>-webkit-transform-origin</code> as 0%, the div block rotates 90 degrees at the far left.<br />
If you don&#8217;t set this, by default, it rotates at center axis.</p>
<h3>&#8230;and Use the Defined Animations</h3>
<pre class="css">
<code>
#matrix div{
  ...
  -webkit-animation-name: fall, fade;
  -webkit-animation-iteration-count: infinite; /* use 0 to infinite */
  -webkit-animation-direction: normal; /* default is normal. use 'alternate' to reverse direction */
  -webkit-animation-timing-function: ease-out;
}
</code>
</pre>
<p>For more detailed info on <code>-webkit-animation</code> properties, read <a href="http://developer.apple.com/documentation/appleapplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html#//apple_ref/doc/uid/TP30001266-VisualEffects" target="_blank">Apple&#8217;s Developer Connection</a></p>
<p>Again, this example is currently working only on the latest WebKit and Safari 4 (not iPhone).<br />
Google Chrome does not support @font-face or animation. (<code>-webkit-transform:rotate...</code> works), and I assume it does not work on Android either.<br />
(And I have no intention to try on other WebKit-base browsers like S60).</p>

]]></content:encoded>
			<wfw:commentRss>http://girliemac.com/blog/2009/05/03/matrix-animation-with-webkit-css3/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
	</channel>
</rss>

