The current morphing implementation contains a dirty hack of descaling (including resetting the R,G,B values when they become larger than 255) because the method _determine_rgb() is called twice, once from morph() and a second time from set_color(). To prevent descaling, a part of the method set_color() has been separated into a private method _set_rgb() which is called both from set_color() and morph(). This also means that the functions _remap_rgb_value_reverse() and _remap_color_reverse() become obsolete. Additionally, applying color inversion has been moved to method _determine_rgb() just before applying max_rgb_value. This assures that first the proper R,G,B values are determined (inverted or not) and afterwards the proper brightness is determined. With this implementation, the morphing starts nicely at the current R,G,B values and gradually transitions towards the end R,G,B values.
The current morphing implementation contains a dirty hack of descaling (including resetting the R,G,B values when they become larger than 255) because the method
_determine_rgb()
is called twice, once frommorph()
and a second time fromset_color()
. To prevent descaling, a part of the methodset_color()
has been separated into a private method_set_rgb()
which is called both fromset_color()
andmorph()
. This also means that the functions_remap_rgb_value_reverse()
and_remap_color_reverse()
become obsolete. Additionally, applying color inversion has been moved to method_determine_rgb()
just before applyingmax_rgb_value
. This assures that first the proper R,G,B values are determined (inverted or not) and afterwards the proper brightness is determined. With this implementation, the morphing starts nicely at the current R,G,B values and gradually transitions towards the end R,G,B values.