Wednesday, September 17th, 2008

iPhone Web App: Spin the Bottle

Category: iPhone, Mobile

Tomi Mickelsson has created a fun iPhone Web App called Spin the Bottle. You know, a Web app, not one that has to get into the Apple store.

You can check it out on the iPhone/Touch/emulator and you will see how Tomi uses the iPhone specific APIs, such as:

javascript

  1. <br /> function startTouch() {<br /> setTimeout(hideURLbar, 100);</p> <p>document.body.ontouchstart = function(e) {<br /> oldangle1 = 0; oldangle2 = 0; oldangle3 = 0;<br /> //spinout();<br /> cancelspin();<br /> }</p> <p>document.body.ontouchmove = function(e) {<br /> // prevent window scrolling!<br /> e.preventDefault();</p> <p>if (timer_rot != 0)<br /> return;</p> <p>var touch = e.touches[0]; // finger 1<br /> var dx = centerx - touch.pageX;<br /> var dy = centery - touch.pageY;<br /> var angle = Math.atan2(dy, dx);</p> <p>oldangle3 = angle;<br /> oldangle1 = oldangle2;<br /> oldangle2 = oldangle3;</p> <p>var val = "rotateZ(" + angle + "rad)";<br /> bottle.style.webkitTransform = val;<br /> shadow.style.webkitTransform = val;<br /> rot = angle;<br /> //cancelspin();<br /> }<br /> document.body.ontouchend = function(e){<br /> if (timer_rot == 0) {<br /> var val = ((oldangle2 - oldangle1) + (oldangle3 - oldangle2)) / 2;<br /> val /= 3;<br /> if (val == 0.0)<br /> val = rand(0.3)+0.2;<br /> else if (Math.abs(val) &lt; 0.3)<br /> val *= 3;</p> <p>//cancelspin();<br /> startanim(val);<br /> }<br /> }<br /> }<br /> // remove our touch handlers<br /> function stopTouch() {<br /> document.body.ontouchstart = null;<br /> document.body.ontouchmove = null;<br /> document.body.ontouchend = null;<br /> }<br />

Posted by Dion Almaer at 8:24 am
3 Comments

+++--
3.1 rating from 23 votes

3 Comments »

Comments feed TrackBack URI

I’m using rss from feedburner to read Ajaxian and in feed, the second link is changed to: http://feeds.feedburner.com/www.idean.com/iphone/spin that point to a different website, http://feeds.feedburner.com/www Please fix the problem (or maybe is a bug from feedburner).

Thanks

Comment by dt — September 17, 2008

It appears that the problem is in the article itself.

Comment by epascarello — September 17, 2008

Maybe this site is interesting for iPhone WebApp Developers too:

http://www.big5apps.com

Comment by perenzo — September 18, 2008

Leave a comment

You must be logged in to post a comment.