[使用P5.js框架]做了一个牛顿摇篮,但是出现了意想不到的问题

I've made a Newton's Cradle [using the P5.js framework], but there's an unexpected problem

一切正常,但程序开始时出现奇怪的卡顿。我不知道是什么原因造成的。 Here's the link to the code

为所有变量分配一些初始值就可以了。