You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
709 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package xyz.wbsite.jmacro.util;
public class AnimateUtil {
/**
* 由快到慢
*
* @param time 时间0~1
* @return 值0~1
*/
public static double easeOut(double time) {
if (time <= 0) {
return 0D;
}
if (time >= 1) {
return 1D;
}
return Math.sin(time * Math.PI / 2);
}
/**
* 由慢到快
*
* @param time 时间0~1
* @return 值0~1
*/
public static double easeIn(double time) {
if (time <= 0) {
return 0D;
}
if (time >= 1) {
return 1D;
}
return 1 - Math.cos(time * Math.PI / 2);
}
}

Powered by TurnKey Linux.