javascript地球卫星同步动画

javascript地球卫星同步动画1172
var canvas = document.getElementById('Canvas_Six');
var context_six = canvas.getContext('2d');
var i = 0, j = 10;
var tm;
var imgSat = new Image();
function orbit() {
i = i + j;
if (i >= 360) { i = 0; }
var t = Math.round(i / 15);
if (t < 10) { t = '0' + t + ' : 00'; }
else
{ t = t + ' : 00'; }
if (i <= 59 || i > 130) {
x = 250 + 210 * Math.cos(i * Math.PI / 180); y = 230 + 40 * Math.sin(-i * Math.PI / 180);
}
else
{ imgSat.src = ''; }
context_six.clearRect(0, 0, 500, 500);
context_six.font = "bold 30pt Calibri";
context_six.fillText('Time: ' + t, 160, 30);
context_six.font = "18pt Calibri";
context_six.fillText('Vivax Solutions', 340, 490);
context_six.fillStyle = 'green';
context_six.drawImage(imgSat, x, y);
imgSat.src = 'sat.png';
}
window.setInterval('orbit()', 180);

也许你还喜欢