Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float Smooth(float start, float end, float amount)
- {
- // Clamp to 0-1;
- amount = (amount > 1f) ? 1f : amount;
- amount = (amount < 0f) ? 0f : amount;
- // Cubicly adjust the amount value.
- amount = (amount * amount) * (3f - (2f * amount));
- return (start + ((end - start) * amount));
- }
- amount = (amount * amount) * (3f - (2f * amount));
- cubic(t) = cubic interpolation
- linear(t) = linear interpolation
- cubic_to_linear(t) = linear(t)*t + cubic(t)*(1-t)
- linear_to_cubic(t) = cubic(t)*t + linear(t)*(1-t)
Add Comment
Please, Sign In to add comment