<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body {
font-family: "Microsoft YaHei", serif;
}
body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
margin: 0;
}
ol, ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: none
}
#wrap{
position: relative;
width: 500px;
height: 500px;
margin: 50px auto;
border: 1px solid #999;
border-radius: 50%;
}
#wrap p.ball{
position: absolute;
top: 0;
left: 250px;
width: 30px;
height: 30px;
margin-left: -15px;
margin-top: -15px;
background-color: pink;
border-radius: 50%;
}
</style>
</head>
<body>
<div id="wrap">
<p class="ball"></p>
</div>
<script>
(function () {
let oBall = document.querySelector("#wrap p.ball");
let d = 0;
setInterval(function () {
d+=0.01;
let left = Math.sin(d)*250 + 250;
let top = 250 - Math.cos(d)*250;
oBall.style.left = left+"px";
oBall.style.top = top+"px";
},10)
})();
</script>
</body>
</html>
Python3Turtle