码迷,mamicode.com
首页 > 其他好文 > 详细

小圆环绕大圆

时间:2017-07-20 13:38:54      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:osi   mat   ack   font   ret   top   sel   cos   selector   

function fn(n) {
return 380 + 100 * Math.sin(n * ((2 * Math.PI) / 7)) - 20;
};
function fm(m) {
return 380 - 100 * Math.cos(m * ((2 * Math.PI) / 7)) - 20;
};
function fg(g) {
div = document.querySelector("#div"+g);
div.style.position = "absolute";
div.style.width = "40px";
div.style.height = "40px"
div.style.background = "brown";
div.style.borderRadius = "20px";
div.style.left = fn(g) + "px"
div.style.top = fm(g) + "px"
};
div = document.querySelector("#div0");
div.style.position = "absolute";
div.style.left = "300px";
div.style.top = "300px";
div.style.width = "160px";
div.style.height = "160px"
div.style.background = "brown";
div.style.borderRadius = "80px";
fg(1);fg(2);fg(3);fg(4);fg(5);fg(6);fg(7);

小圆环绕大圆

标签:osi   mat   ack   font   ret   top   sel   cos   selector   

原文地址:http://www.cnblogs.com/YCxiaoyang/p/7208474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!