Game Development Reference
In-Depth Information
for (var i = 0, len = marks.length; i < len;
i++) {
document.body.removeChild(marks[i]);
}
}
// Create a DOM element for each active touch
detected by the
// input device. Each node is positioned where
the touch was
// detected, and has a width and height close
to what the device
// determined each touch was
function addTouch(event) {
// Get a reference to the touches TouchList
var _touches = event.touches;
// Flush the current touches array
touches = new Array();
for (var i = 0, len = _touches.length; i <
len; i++) {
var width = _touches[i].webkitRadiusX * 20;
var height = _touches[i].webkitRadiusY * 20;
var touch = document.createElement("div");
touch.style.width = width + "px";
touch.style.height = height + "px";
touch.style.left = (_touches[i].pageX -
width / 2) + "px";
touch.style.top = (_touches[i].pageY -
height / 2) + "px";
touches.push(touch);
}
}
Search WWH ::




Custom Search