svader0 / sandbox

Falling Sand Game Built in Rust
0 stars 2 forks source link

Create smoother movement with interpolation #9

Open svader0 opened 6 months ago

svader0 commented 6 months ago

Right now, when you drag the mouse quickly, the placement of the elements looks sort of stuttered. To fix this, I started implementing a higher-order function called "traverse_line" that applies a given function to every pixel across a line (from one 2D point to another). Then, between every frame, we would draw a line of pixels from the previous to current mouse position. This would have other helpful applications down the line.