バネの動きを作るには、目標となる座標と目標に近づくための移動値という2つの変数を作ると実現できます。
クリックした座標を目標となる座標。クリックした場所と、今の位置の距離を移動値として減衰させながら進めることで、目標の座標を超えても、再度方向を変えて移動するので、バネのように動きます。
To create spring-like motion, you can use two variables: a target position and a movement value that moves the object toward the target.
The position where you click bevomes the target position.
The distance between the current position and the click position is used as the movement value, which gradually decreases over time.
Because the movement value does not immediately become zero, the object overshoots the target and then changes direction, creating a spring-like motion.
次回

