This site uses cookies! Learn More

This site uses cookies!

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.

Gaze

Progress Bar Color ( Get Color Between Two Colors )

8 posts in this topic

Please login or register to see this spoiler.

 

AND THIS IS NOT HOW TO DO IT,

 

use:

Please login or register to see this code.

Thanks YoungDeveloper

Edited by straatbaas
1 person likes this

Share this post


Link to post
Share on other sites

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

2 people like this

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

Because that lerps it? This is direct.

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

no

 

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

 

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

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 this post


Link to post
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.

Please login or register to see this code.

The docs support what i wrote you, (i didnt know) but even there its written that t is clamped 0 to 1.
Please login or register to see this link.

1 person likes this

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

 

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

Thanks a ton YoungDeveloper, really appreciate it :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now