vanilladocs
vanillapunch.com
API / core/tween/easing_function/elastic

core/tween/easing_function/elastic

튕기는 고무줄.

  • 원본은 a = 0.1, p = 0.4 로 시작하지만 a < 1 이면 a = 1, s = p / 4 로 바꾸므로 늘 아래 값이다.

Springy rubber band.

  • The original starts with a = 0.1, p = 0.4, but since a < 1 changes it to a = 1, s = p / 4, it always uses the values below.
예제Example끝을 넘고 처음 아래로 내려가는 값Values that overshoot the end and dip below the start
use vanilla::easing_function::elastic;

assert_eq!(elastic::ease_out(0.0), 0.0);
assert_eq!(elastic::ease_out(1.0), 1.0);
assert!((elastic::ease_out(0.2) - 1.25).abs() < 1e-5);
assert!((elastic::ease_in(0.8) + 0.25).abs() < 1e-5);

함수Functions

함수functionpub fn ease_in(progress: f64) -> f64#0.4.0 부터since 0.4.0소스source

시작에서 떨다가 나아간다.

Wobbles at the start, then moves forward.

progressf64
진행률. (0 ~ 1)Progress. (0 ~ 1)

반환Returnsf64 보간 비율. (0 에서 0, 1 에서 1, 사이에서는 0 ~ 1 밖으로 넘치며 떤다)Interpolation ratio. (0 at 0, 1 at 1, in between it wobbles overshooting outside 0 ~ 1)

함수functionpub fn ease_out(progress: f64) -> f64#0.4.0 부터since 0.4.0소스source

끝을 넘었다가 떨며 멈춘다.

Overshoots the end, then wobbles to a stop.

progressf64
진행률. (0 ~ 1)Progress. (0 ~ 1)

반환Returnsf64 보간 비율. (0 에서 0, 1 에서 1, 사이에서는 0 ~ 1 밖으로 넘치며 떤다)Interpolation ratio. (0 at 0, 1 at 1, in between it wobbles overshooting outside 0 ~ 1)

함수functionpub fn ease_in_out(progress: f64) -> f64#0.4.0 부터since 0.4.0소스source

시작과 끝에서 떤다.

Wobbles at the start and the end.

progressf64
진행률. (0 ~ 1)Progress. (0 ~ 1)

반환Returnsf64 보간 비율. (0 에서 0, 1 에서 1, 사이에서는 0 ~ 1 밖으로 넘치며 떤다)Interpolation ratio. (0 at 0, 1 at 1, in between it wobbles overshooting outside 0 ~ 1)