[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Starting the pygame 2 series

On Mon, 2019-07-15 at 01:32 +0200, René Dudfield wrote:
> Thanks to @charlesoblack (first time contributor ya!) there is a
> pygame.Color.lerp() function now. It returns a linear interpolation.
> >>> color.lerp(color2, 0.0) -> color 
> >>> color.lerp(color2, 0.5) -> halfway_color 
> >>> color.lerp(color2, 1.0) -> color2

That's handy. I wonder if it might even be worth taking it a step further, so
you can just pass an object to a function to update the color progressively
(i.e. it doesn't need to know the color, it just updates the progress value),
such as:

   color_lerp = ColorLerp(color1, color2)
   progress = 0
   while progress < 1:
       progress += 0.1

Or anything along those lines...

Attachment: signature.asc
Description: This is a digitally signed message part