Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script type = "text/javascript" src = "https://d3js.org/d3.v4.min.js"></script>
  5. </head>
  6.  
  7. <body>
  8. <div id = "svgcontainer"></div>
  9. <script>
  10. var width = 1900;
  11. var height = 700;
  12. //Create SVG element
  13. var svg = d3.select("#svgcontainer")
  14. .append("svg")
  15. .attr("width", width)
  16. .attr("height", height);
  17. //draw rectangles with nested loops
  18. let brightness=0;
  19. for (y=0; y<20; y++){
  20. let blue1=Math.floor(y/20*255).toString(16)
  21. let blue2='00'.substring(0,2-blue1.length)+blue1
  22. svg.append("a")
  23. .attr("xlink:href", "http://en.wikipedia.org/")
  24. .append("rect")
  25. .attr("xlink:href", "http://google.com")
  26. .attr("x", 10)
  27. .attr("y", y*30)
  28. .attr("width", 200)
  29. .attr("height", 20)
  30. .attr("fill", '#'+'00'+'00'+blue2);
  31. //svg.append("a")
  32. // .attr("xlink:href", "http://en.wikipedia.org/")
  33. // .append("text")
  34. // .attr("x", x+5)
  35. // .attr("y", y+17)
  36. // .style("fill", "white")
  37. // .style("font-size", "20px")
  38. // .text("thing "+step);
  39. //brightness+=1;
  40. }
  41. </script>
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement