Making a Gradient Pattern

The Ray Tracer Challenge — by Jamis Buck (62 / 108)

👈 Generalizing Patterns | TOC | Making a Ring Pattern 👉

A gradient pattern is like stripes, but instead of discrete steps from one color to the next, the function returns a blend of the two colors, linearly interpolating from one to the other as the x coordinate changes. If the first color is red, and the second is blue, the resulting gradient will look like this:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
The Pragmatic Programmers

The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.