2023-12-27 02:18:19 +08:00

15 lines
405 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @method 缓动算法
* t: current time当前时间
* b: beginning value初始值
* c: change in value变化量
* d: duration持续时间
*/
export function tween(t: number, b: number, c: number, d: number): number {
return c * (t /= d) * t * t + b
}
export function linear(t: number, b: number, c: number, d: number): number {
return (c * t) / d + b
}