jquery实现动态画圆
今天自己在写插件过程做中找到的一个不错的知识。自己做了一个小例子。
<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title>无标题文档</title>
<!--脚本加载-->
<scriptsrc="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"type="text/javascript"></script>
<scripttype="text/javascript">
$(document).ready(function(e){
vara=200,b=200,r=90,times=0;
setInterval(functionflutter(){
times+=0.1;
varhudu=(2*Math.PI/360)*6*times;
varX=a+Math.sin(hudu)*r;
varY=b-Math.cos(hudu)*r // 注意此处是“-”号,因为我们要得到的Y是相对于(0,0)而言的。
//$(".sky_text").css({"left":X+"px","top":Y+"px"});
$("body").append('<divstyle="position:absolute;left:'+X+'px;top:'+Y+'px;width:1px;height:1px;background:#00F;"></div>');
if(times==60){
return;
}
},2);
});
</script>
<styletype="text/css">
body,html{padding:0;margin:0;}
</style>
</head>
<body>
<divstyle="position:absolute;left:198px;top:198px;width:4px;height:4px;background:#F00;"></div>
</body>
</html>
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下