Jump to content

(Help) Interpolate / Progress


Recommended Posts

Hello, I ran into a little problem while interpolating between GREEN and RED.
When the time value reached '500' it was suppose to start from GREEN and fade into RED until the time value reached '600'.
Problem is, it does not start at full GREEN because the time value is already '500' at the point in the function.

I tried a bunch of math calculations to fix this but can't seem to figure it out. I'd appreciate any sort of help.

	if (time >= 500 and time < 600) then
        -- local progress = (time/600)
		local progress = (time/100) -- time value at this point is '500'
		selection_color = tocolor(interpolateBetween( 0, 255, 0, 255, 0, 0, progress, "Linear"))
	end

 

Link to comment
8 minutes ago, Simon54 said:
Ohh okay okay I see now.
local progress = (time - 500) / 100 -- Normalize progress between 0 and 1

Thank you man, I appreciate 🙏

You're welcome. If you have any problems, please let me know.

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...