JSFiddle - React, Tailwind, and code Playground
by B L Praveen
HTML
<script src="https://d3js.org/d3.v5.js"></script>
<svg id="svg1" style="margin: 0 auto; display: block;"></svg>
JavaScript
//const svg = d3.select('#svg1');
const svg = d3.select('#svg1')
.attr('width', 400)
.attr('height', 400)
.style('background-color', 'black');
const line = svg.append('line')
.style("stroke", "lightgreen")
.style("stroke-width", 10)
.attr("x1", 0)
.attr("y1", 0)
.attr("x2", 200)
.attr("y2", 200);
//console.log(line.getBBox())9
var inter = d3.interpolateArray([0, 0], [200,200])
alert(inter(0.2));