Use a linearGradient
in the SVG.
In the SVG:
<linearGradient id="grad">
<stop offset="0%" stop-color="red"/>
<stop offset="0%" stop-color="transparent"/>
</linearGradient>
and in the Javascript:
$('#grad stop').attr('offset',offset+'%');
Like this JSFiddle example.