Collapse
In this task, you will create a smooth horizontal gradient that transitions from red on the left to blue on the right. The fragment shader currently displays a solid color, but your goal is to modify it to create this color gradient.
To achieve this, you’ll use the x-coordinate
of each pixel (normalized to a range of
0.0
to 1.0
) to interpolate between red (vec4(1.0, 0.0, 0.0, 1.0)
) and
blue (vec4(0.0, 0.0, 1.0, 1.0)
). The mix()
function will help you blend these two
colors seamlessly based on the pixel’s horizontal position.
By the end, the screen should display a smooth gradient where the left edge is completely red, the right edge is completely blue, and the middle transitions smoothly between the two.
Fetching Status...