This PR adds support for color functions in two ways:
In the Type dropdown next to "Color ramp" and "Image". The function should return an RGBA tuple.
The "Custom expression" output which was already there as a placeholder. The function should return a number between 0 and 1 which will be used to get the color of the color ramp or the pixel in the color image.
Example of how it can be used to add color animations in a bit more dynamic way than creating 2D images for the Image type:
# note: `if` conditions for readability, could be optimized in 1 line of math
def fade_sorted(frame, time_fraction, drone_index, formation_index, position, drone_count):
factor = min(max(drone_count * (1.1 * time_fraction - formation_index / drone_count), 0.0), 1.0)
if formation_index >= 112:
return factor * 1.0
if formation_index % 2 == 0:
return 0.66 * factor
return 0.33 * factor
This PR adds support for color functions in two ways:
Example of how it can be used to add color animations in a bit more dynamic way than creating 2D images for the Image type:
https://github.com/skybrush-io/studio-blender/assets/66438062/9e5caf9a-d264-48f4-8bdc-e833644e0329