Advertisement
lyonlyke

JS CALCULATOR SVG ICON

Jul 27th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>BIBLE SVG JS</title>
  5.  
  6. <style>
  7.  
  8. #boxe {
  9. display:block;
  10. margin:0 auto;
  11. height:64px;
  12. width:64px;
  13. }
  14.  
  15.  
  16. #boxe svg {
  17. display:block;
  18. width:100%;
  19. height:100%;
  20. margin:0 auto;
  21. }
  22. </style>
  23.  
  24. <script>
  25.  
  26. function calcuSVGenerator(){
  27. document.write('<span id="boxe"><svg viewBox="0 0 64 64">');
  28. document.write('<defs>');
  29. document.write('<pattern id="slate" width="64" height="64" patternUnits="userSpaceOnUse"><g>');
  30.  
  31. cubeSVG(52,62,'#596674',10,1);
  32.  
  33. cubeSVG(45,10,'#85CDEA',13,3);
  34.  
  35. cubeSVG(13,10,'#CC9966',13,15);
  36. cubeSVG(13,10,'#CC9966',29,15);
  37. cubeSVG(13,10,'#CC9966',45,15);
  38.  
  39. cubeSVG(13,10,'#CC9966',13,27);
  40. cubeSVG(13,10,'#CC9966',29,27);
  41. cubeSVG(13,10,'#CC9966',45,27);
  42.  
  43. cubeSVG(13,10,'#CC9966',13,39);
  44. cubeSVG(13,10,'#CC9966',29,39);
  45. cubeSVG(13,10,'#CC9966',45,39);
  46.  
  47. cubeSVG(13,10,'#CC9966',13,51);
  48. cubeSVG(13,10,'#CC9966',29,51);
  49. cubeSVG(13,10,'#CC9966',45,51);
  50.  
  51.  
  52. document.write('<\/g><\/pattern><\/defs>');
  53. document.write('<rect x="0" y="0" width="100%" height="100%" fill="url(#slate)" \/>');
  54. document.write('<\/svg><\/span>');
  55.  
  56.  
  57. function cubeSVG(W,H,F,X,Y){
  58. var w = W - 10;
  59. var h = H - 10;
  60.  
  61. var cube =[3,0,7,0,8.5,0.4,9.1,0.9,9.6,1.5,10,3,10,7,9.6,8.5,9.1,9.1,8.5,9.6,7,10,3,10, 1.5,9.6, 0.9,9.1, 0.4,8.5, 0,7, 0,3, 0.4,1.5, 0.9,0.9, 1.5,0.4, 3,0,5,0];
  62.  
  63. for(i = 0; i < cube.length;i = i + 2){
  64. var j = i + 1;
  65. cube[i] = cube[i] + X;
  66. cube[j] = cube[j] + Y;
  67. }
  68.  
  69. for(i = 2; i < 21;i = i + 2){cube[i] = cube[i] + w;}
  70. for(i = 13; i < 31;i = i + 2){cube[i] = cube[i] + h;}
  71.  
  72. var a = "";
  73.  
  74. for(i = 0; i < cube.length;i = i + 2){
  75.  
  76. var a = a + cube[i]+','+cube[i+1]+' ';
  77. }
  78.  
  79. document.write('<polyline fill="'+F+'" stroke="#020202" stroke-width="1" points="'+a+'"><\/polyline>');
  80. }
  81. }
  82.  
  83. </script>
  84.  
  85. </head>
  86. <body>
  87. <script>
  88.  
  89. calcuSVGenerator();
  90.  
  91. </script>
  92. </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement