API / core/tween/easing_function
core/tween/easing_function
이징 함수. (원본 Tween.easingFunction)
- 진행률(0 ~ 1)을 받아 보간 비율을 돌려준다. back, elastic 은 0 ~ 1 밖으로 넘친다.
- 원본은 인자 k 를 그 자리에서 바꿔 가며(k *= 2, --k) 쓴다. 여기서는 바뀐 값마다 이름을 붙였다.
Easing function. (the original Tween.easingFunction)
- Takes the progress (0 ~ 1) and returns the interpolation ratio. back, elastic overshoot outside 0 ~ 1.
- The original modifies the argument k in place (k *= 2, --k). Here each changed value is given a name.
예제Example이징 값 보기와 트윈에 걸기Check easing values and apply one to a tween
use vanilla::{easing_function, Tween, TweenValues};
assert_eq!(easing_function::linear(0.25), 0.25);
assert_eq!(easing_function::quadratic::ease_in(0.5), 0.25);
let tween = Tween::new(TweenValues::new().with("x", 0.0))
.to(TweenValues::new().with("x", 100.0), 0.5)
.easing(easing_function::back::ease_out);
assert!(!tween.is_finished());함수Functions
선형.
Linear.
- progressf64
- 진행률. (0 ~ 1)Progress. (0 ~ 1)
반환Returnsf64 보간 비율. (progress 그대로)Interpolation ratio. (progress as is)