Skip to content

Instantly share code, notes, and snippets.

@Stiner
Created July 22, 2019 01:00
Show Gist options
  • Save Stiner/8de1b4b94d8a18171e3eedb8045ca1aa to your computer and use it in GitHub Desktop.
Save Stiner/8de1b4b94d8a18171e3eedb8045ca1aa to your computer and use it in GitHub Desktop.

Revisions

  1. Stiner created this gist Jul 22, 2019.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    // Smooth
    x = lerp(x, target_x, 0.1);
    x += (target_x - x) * 0.1;

    // Spring
    spdx = lerp(spdx, (target_x - x) * 0.5, 0.2);
    x += spdx;