Home > Back-end >  SVG Linear gradient hard stop
SVG Linear gradient hard stop

Time:06-06

I am trying to achieve a hard stop in linear gradient as S1

CodePudding user response:

const stop2 = document.createElementNS('svgns', 'stop');

should be

const stop2 = document.createElementNS(svgns, 'stop');

See demo: https://codepen.io/smpao1/pen/vYdaWMW

The namespace is set to the namespace 'svgns', which will not get interpreted as a valid svg element, and is thus ignored.

  • Related