this is my simple function ('mycompass' is a div in my body)
function watchCompass() {
var suc = function(a){
var r =a.magneticHeading;
document.getElementById('mycompass').style.webkitTransform = "rotateZ("+-r+"deg)";
};
var fail = function(){};
var opt = {};
opt.frequency = 50;
timer = navigator.compass.watchHeading(suc,fail,opt);
}
for some reason when the compass 'wheel' does a complete rotation from 0 to 360 it goes back to 0 and not to the "virtual" 361... etc.. is not able to understand that from 0 and 360 there is no difference ...
and I don't know how to calculate a way to have the wheel spining smoothy clockwise and anticlockwise
another way to put this question is:
how can i rotate my objext from, for instance, from 15deg to 270deg, in anti-clockwise direction instead of clockwise? how can i tell my script that vale?