Reflect color of one object to another object through cursor position

read this good start

https://processing.org/examples/lineargradient.html