js写个小球在弹性和重力的运动
直接干货 碰撞没做
<style>
html, body {
height: 100%;
width: 100%;
margin: 0;
}
canvas{
width: 100%;
height: 100%;
}
</style>
<canvas id="canvas"></canvas>
<script>
class dan{
constructor () {
this.width = 0
this.height = 0
this.canvas = null
this.points = []
this.g = 0.98
this.spring = 0.9
this.frictionAir = 0.99
this.timeId = null
}