首页 > 其他 > 详细

圆周运动

时间:2019-02-14 16:37:27      阅读:174      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin:0;
padding:0;

}
#ha{
width:500px;
height:500px;
border:red 1px solid;
border-radius:50%;
position:relative;
margin:100px auto;
}
#circle{
width:20px;
height:20px;
background:blue;
position:absolute;
border-radius:50%;
top:-10px;
left:240px;
}
</style>
</head>
<body>
<div id="ha">
<div id="circle">

</div>
</div>
</body>
</html>
<script>
var circle=document.getElementById("circle");
var t=null;
var num=0;
t=setInterval(function(){
num++
circle.style.left=250+250*Math.sin(num*(Math.PI/180))-10+"px"
circle.style.top= 250-250*Math.cos(num*(Math.PI/180))-10+"px"

},100)
</script>

圆周运动

原文:https://www.cnblogs.com/shangjun6/p/10375305.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!