Circular motion

= to function FUNCTION is window.onload, (), {
var = document.getElementById oDiv, ( '' div1 ''),;
var r = 100; 半径//
//位置圆心of the
var and 700 with the x =; left a textfile //
var-y, = to 300; on the top of a textfile //
var num = and 0; 角度//
setInterval, (to function FUNCTION is, (), {
num ++;
//Math.sin , (num Math.PI / of 180), = a and / r, the;
//Math.cos , (num
Math.PI / of 180), = b / r, the;
var = a and Math.sin, (num Math.PI / of 180), * r, the;
var b = Math.cos, (num
Math.PI / of 180), * r, the;
oDiv.style.left the x = +, b +, '' px '';
oDiv.style.top a and-y, +, +, = '' px '';
// var = document.createElement oBox, ( '' div ''),;
// oBox.className = '' box on the '';
// document.body.appendChild, (oBox),;
// oBox.style.left = oDiv.offsetLeft + ‘px’;
// oBox.style.top = oDiv.offsetTop + ‘px’;
},30);
};

Guess you like

Origin blog.csdn.net/weixin_45052104/article/details/91281743