Tomi Mickelsson씨가 병을 돌려라(Spin the Bottle)라는 이름의 iPhone 웹 프로그램을 만들었습니다. 아시다시피, 웹 프로그램은 애플 스토어에 들어갈 필요가 없습니다.
iPhone/Touch/에뮬레이터에서 프로그램을 실행해볼 수 있습니다. 그리고 아래처럼 Tomi씨가 iPhone의 특수 API들을 어떻게 사용했는지 보실 수 있을 것입니다:
from iPhone Web App: Spin the Bottle
iPhone/Touch/에뮬레이터에서 프로그램을 실행해볼 수 있습니다. 그리고 아래처럼 Tomi씨가 iPhone의 특수 API들을 어떻게 사용했는지 보실 수 있을 것입니다:
[code:js]
function startTouch() {
setTimeout(hideURLbar, 100);
document.body.ontouchstart = function(e) {
oldangle1 = 0; oldangle2 = 0; oldangle3 = 0;
//spinout();
cancelspin();
}
document.body.ontouchmove = function(e) {
// prevent window scrolling!
e.preventDefault();
if (timer_rot != 0)
return;
var touch = e.touches[0]; // finger 1
var dx = centerx - touch.pageX;
var dy = centery - touch.pageY;
var angle = Math.atan2(dy, dx);
oldangle3 = angle;
oldangle1 = oldangle2;
oldangle2 = oldangle3;
var val = "rotateZ(" + angle + "rad)";
bottle.style.webkitTransform = val;
shadow.style.webkitTransform = val;
rot = angle;
//cancelspin();
}
document.body.ontouchend = function(e){
if (timer_rot == 0) {
var val = ((oldangle2 - oldangle1) + (oldangle3 - oldangle2)) / 2;
val /= 3;
if (val == 0.0)
val = rand(0.3)+0.2;
else if (Math.abs(val) <0.3)
val *= 3;
//cancelspin();
startanim(val);
}
}
}
// remove our touch handlers
function stopTouch() {
document.body.ontouchstart = null;
document.body.ontouchmove = null;
document.body.ontouchend = null;
}
function startTouch() {
setTimeout(hideURLbar, 100);
document.body.ontouchstart = function(e) {
oldangle1 = 0; oldangle2 = 0; oldangle3 = 0;
//spinout();
cancelspin();
}
document.body.ontouchmove = function(e) {
// prevent window scrolling!
e.preventDefault();
if (timer_rot != 0)
return;
var touch = e.touches[0]; // finger 1
var dx = centerx - touch.pageX;
var dy = centery - touch.pageY;
var angle = Math.atan2(dy, dx);
oldangle3 = angle;
oldangle1 = oldangle2;
oldangle2 = oldangle3;
var val = "rotateZ(" + angle + "rad)";
bottle.style.webkitTransform = val;
shadow.style.webkitTransform = val;
rot = angle;
//cancelspin();
}
document.body.ontouchend = function(e){
if (timer_rot == 0) {
var val = ((oldangle2 - oldangle1) + (oldangle3 - oldangle2)) / 2;
val /= 3;
if (val == 0.0)
val = rand(0.3)+0.2;
else if (Math.abs(val) <0.3)
val *= 3;
//cancelspin();
startanim(val);
}
}
}
// remove our touch handlers
function stopTouch() {
document.body.ontouchstart = null;
document.body.ontouchmove = null;
document.body.ontouchend = null;
}
from iPhone Web App: Spin the Bottle
'[IT] Web Tech' 카테고리의 다른 글
IE 8 Beta 2 Ajax 기능 (0) | 2008.10.08 |
---|---|
JavaScript로 만든 팩맨 (0) | 2008.09.20 |
iPhone에서도 SVG를 사용할 수 있습니다 (0) | 2008.09.19 |
리눅스에서도 AIR를!! (0) | 2008.09.18 |
iPhone Web App: Spin the Bottle (0) | 2008.09.18 |
구글 크롬과 IE의 새로운 프로파일러와 디버거 (0) | 2008.09.17 |
CSS 변형 : WebKit에서 먼저 되고, 이제는 Gecko에서도!! (0) | 2008.09.17 |
iPhone에서의 3D CSS 변환 (0) | 2008.09.09 |
mtjs_iepnghandler: IE 6 를 위한 더 나은 PNG 지원 (3) | 2008.08.13 |
댓글을 달아 주세요