Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
バネ
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