D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
ezzaouia
Full window
Github gist
player proto
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0; position: fixed; top:0; right:0; bottom:0; left:0; } </style> </head> <body> <script> const margin = {left: 20, top: 20, }; const width = window.innerWidth; const height = 500; const player_height = 100; let gholder = d3.select("body") .append("svg") .attr("width", 960) .attr("height", 500) .append('g') .classed('gholder', true) .attr('transform', `translate(${margin.left}, ${margin.top})`); let annotation = gholder.append('g') .classed('annotation', true) .attr('transform', `translate(${0}, ${0})`); let player = gholder.append('g') .classed('player', true) .attr('transform', `translate(${0}, ${height / 2 + 10})`); annotation.append('rect') .attr('width', (width - margin.left)) .attr('height', height/2) .attr('fill', 'green') player.append('rect') .attr('width', (width - margin.left)) .attr('height', height/2) .attr('fill', 'red'); </script> </body>
https://d3js.org/d3.v4.min.js