armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

# Progress Bar Color ( Get Color Between Two Colors )

## Recommended Posts

AND THIS IS NOT HOW TO DO IT,

use:

Thanks YoungDeveloper

Edited by straatbaas
• 1

##### Share on other sites

Why not just Color.Lerp(color1, color2, floatFrom0to1) ?

• 2

##### Share on other sites

Because that lerps it? This is direct.

##### Share on other sites

no

Color.Lerp(color1, color2, m_currentAmount / m_maxAmount)

##### Share on other sites

I don't know if there are more ways to lerp than I know, or if I didn't explain myself well.

Color.Lerp lerps color1 to color 2 at m_currentAmount / m_maxAmount  as given speed (if you use Color.Lerp(color1, color2, m_currentAmount / m_maxAmount) )  right?

My point isn't the interpollation part, it's figuring out what color lies in between the 2 colors if you give it a value between 0 and 1.

Or does the lerp do the exact same thing? Because I thought it just lerps towards a color at a given speed..

##### Share on other sites

Lerp is linear interpolation, nothing more, just because most people use it in update doesn't mean its meant for update, in fact it isn't and most people use it incorrectly.
By your comments i get that you dont understand lerp too. 3rd param is not speed, it should be a value from 0 to 1. "Developers" usually pass value itself in 0 so it moves to 1, but mathematically will never reach 1 - it will be Zeno's paradox. But it only reaches 1 (very very slowly) just because of the imprecision of the float itself, which tails gets cut off when extremely small values are operated.

You should really know exactly, what is lerp, before telling me how to use it.

The docs support what i wrote you, (i didnt know) but even there its written that t is clamped 0 to 1.

• 1

##### Share on other sites

Well, cut off my legs and call me shorty, I'm amazed.

Thanks a ton YoungDeveloper, really appreciate it

np, have fun