CHANNELS:

All
h
harp34 posted 2 years ago
chris posted 2 years ago

Basically, in order to calculate the new vertex positions, they need to be relative to the original position in which they were placed. The sin and 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.

0
h
harp34 posted 2 years ago

thanks Chris.

You can just use: array[i] += Math.random() - 0.5 or array[i + 1] += Math.random() - 0.5

and etc.

does the same exact thing. use a lot less code and memory too.

0

Want to participate?

Create a free Chris Courses account to begin

or
Sign In

Providing the lift to launch your development career

© 2024 Chris Courses. All rights reserved.