Unicopia/src/main/java/com/minelittlepony/unicopia/util/AnimationUtil.java

20 lines
556 B
Java
Raw Normal View History

2022-01-05 17:54:54 +01:00
package com.minelittlepony.unicopia.util;
import net.minecraft.util.math.MathHelper;
public interface AnimationUtil {
/**
* Converts a smooth 0-1 transition to a smooth 0-1-0 transition
*/
static float seesaw(float progress) {
return Math.max(0, MathHelper.cos((progress - 0.5F) * (float)Math.PI));
}
/**
* Converts a smooth 0-1 transition to a stretched 0-1-1-1-1-0 transition
*/
static float seeSitSaw(float progress, float clipRatio) {
return Math.min(1, seesaw(progress) * clipRatio);
}
}