Skip to content

Instantly share code, notes, and snippets.

@ikeryou
Created September 1, 2016 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikeryou/c92f7a5b604171c6011ea100a852573e to your computer and use it in GitHub Desktop.
Save ikeryou/c92f7a5b604171c6011ea100a852573e to your computer and use it in GitHub Desktop.
バネ
var spring = 0.5;
var friction = 0.5;
var v = 0;
var t = 100; // 目標値
var val = 0; // 現在値
function update() {
v += (t - val) * spring;
val += (v *= friction);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment