この質問は、数日前に投稿した以前の質問に取って代わります。コードを書き直して、HTML5 Canvas を完全に削除しました。
jQueryRotate を IE で動作させるのに苦労しています。私のコードは Firefox と IE9 で動作しますが、
'parentNode' is null or not an object - in IE8.
http://jsfiddle.net/otherDewi/pm4Ng/2/
XHair、yHair は十字線を配置し、mousemove 関数の残りのコードは銃の角度を計算します。
$wrapper.mousemove(function(e){
xHair=e.pageX-45;
yHair=e.pageY-45;
xGPos = xHair/4+280;
yGPos = yHair/4+200;
difx = xHair-(190+xGPos);
dify = yHair -(185+ yGPos);
radians = Math.atan2(dify,difx);
//rotation = radians+2.36; //rotation in radians
rotation = (((radians*180)/Math.PI)+135); //rotation in degrees
//console.log(rotation);
});
jsFiddle では、 $gun.rotate 行のいずれかがコメントアウトされている場合、コードは機能します
function shotGun(){
//$gun.rotate({angle:rotation});
//$gun.rotate({angle:45});
$gun.css('margin-left', xHair/4+280);
$gun.css('margin-top', yHair/4+200);
}