LoginSignup
12
13

More than 5 years have passed since last update.

イージングの公式

Last updated at Posted at 2015-12-28
formula
nowValue += (targetValue - nowValue) * 0.03;

現在の値 += (目標値 - 現在の値) * イージング係数

easing.gif

目的地付近に近づくにつれ減速するデモです。
(本当はちゃんとx:0の左端から発進するんですがなぜか録画うまくいかず..)

Processingのコードです。

sample
float nowPos = 0;
float tagetPos = 500;

void setup(){
  size(500,500);
}

void draw(){
  background(0);
  nowPos += (tagetPos - nowPos) * 0.03;  // ここ!
  ellipse(nowPos, 200, 30, 30);
}
12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13