All examples By author By category About

tomshanley

Area segment fill using gradient

Suggested answer to an SO question on filling a segment of an area between two paths

A linearGradient is created and used as fill on the area between two lines. And then a rect with 0 opacity has mousemove event attached, which uses the mouse's position to update a linearGradient's offsets' proportions.

A new updated version is here: https://bl.ocks.org/tomshanley/373640a6bc6f89293507550ae5629488/

Built with blockbuilder.org