Basically, in order to calculate the new vertex positions, they need to be relative to the original position in which they were placed. The
cos functions will only work correctly if we have a reference to the point's original value, otherwise, the vertices would be pushed off the screen as the animation loop continues to run.
Try taking the originalPosition object out of the equation and you'll see what I mean by the points getting pushed to the side.
Want to participate?
Create a free Chris Courses account to begin