That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the en…

Forum Archive That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the en…

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6184
    krystman
    Participant

      That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the end needs to be animated from 0.0f to 1.0f. Giving 1.0f immediately set the color at the final value.

      #25011
      Jonathan Gonzalez
      Participant

        I’m not sure what you’re saying. The Color.lerp? We’re going from white to red and vice versa using the fade variable set to 1.0f. What would be your suggestion otherwise?

        #25012
        krystman
        Participant

          If you write

          Color.Lerp(Color.white, Color.red, 1.0f);

          that’s the same as simply writing

          Color.red;

          The final parameter (1.0f) denotes the progress/position of the LERP, not the time or speed. So

          Color.Lerp(Color.white, Color.red, 0.5f);

          would return a color midway between white a red.

          If you you intended to made the color fade in that script, here is how it would work:

          http://pastebin.com/xQAfEwAR

          #25013
          Jonathan Gonzalez
          Participant

            I see what you mean. Maybe “fadeTime” wasn’t the best name for the variable but nonetheless the effect is what we are going for. Changing from white to red.

            #25014
            krystman
            Participant

              Are you sure you are familiar with how that function works? There is no “effect”. There is no animation. You just change the color instantly to a different one. The way it is set up the you can’t make the transition gradual. The Lerp is completely superfluous. I don’t understand why you have it there. I haven’t seen the entire flow yet. Perhaps you do something with the Lerp later?

              I think you should have left the Lerp out and written

              crosshair.color = Color.white;

              and

              crosshair.color = Color.red;

              You do that below at the else part so you seem to be aware that this works.

              I worried the way it is right now is unnecessarily obtuse and misleading for newcomers.

              #25015
              Jonathan Gonzalez
              Participant

                Yes I understand how it works. Is it entirely necessary to use Lerp? No, but it is one way to do it. We’re going form one color to another. It’s not misleading as it’s still going to achieve the effect we want.

                The effect being white going to red and vice versa. This is what I mean by “effect”. There are multiple ways of doing something and I like to show different ways of achieving something. I understand what you’re saying. I think I’ve explained why I used it, and you’ve explained your reasoning as well. Lets not make this into a message board interaction, thanks.

                #25016
                krystman
                Participant

                  I guess we have to agree to disagree. Sorry about being so hardass about it. Keep it up!

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The topic ‘That Lerp part makes no sense. Lerp is used to interpolate between two values. To have a fade the float argument at the en…’ is closed to new replies.