VBA - Get the content data table inside the JavaScript [closed] - html
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm having problem with getting td-content. It seems the data display using javascript, need to pull pictures data.
Table data:
Already try using the basic scrape, but can't collected the data.
VBA Code:
post = Trim(doc.getElementsByClassName("chart-content-container")(5).getElementsByTagName("table")(0).getElementsByTagName("tbody")(0).getElementsByTagName("tr")(1).innerText)
the data i want to get is from here (required login to see data, basically login using facebook):
fanpagedata
html
<div id="id1355">
<span class="chart-container" id="id12c4">
<div class="chart-title">Types of posts</div>
<div class="chart-content-container">
<div class="chart-content-sameInnerHeight" style="margin-top: 50px;" id="id1302">
<div id="id1355">
<div style="position: relative;">
<div id="dashboard9566356">
<div style="position: relative;" id="chartDiv9566356"><div style="position: relative;"><div dir="ltr" style="position: relative; width: 563px; height: 200px;"><div style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;" aria-label="A chart."><svg width="563" height="200" aria-label="A chart." style="overflow: hidden;"><defs id="defs"></defs><g><path d="M282,23.5L282,10A90,90,0,0,1,341.68103924167156,32.63403266460091L332.72888335542086,42.73892776491077A76.5,76.5,0,0,0,282,23.5" stroke="#ffffff" stroke-width="1" fill="#c2185b"></path></g><g><path d="M263.6923516820019,25.722950966907007L260.4615902141199,12.615236431655305A90,90,0,0,1,282,10L282,23.5A76.5,76.5,0,0,0,263.6923516820019,25.722950966907007" stroke="#ffffff" stroke-width="1" fill="#f57c00"></path></g><g><path d="M206.0577711314989,109.22105603953229L192.65620133117517,110.84830122297916A90,90,0,0,1,260.4615902141197,12.615236431655333L263.69235168200174,25.722950966907035A76.5,76.5,0,0,0,206.0577711314989,109.22105603953229" stroke="#ffffff" stroke-width="1" fill="#8ecbd3"></path></g><g><path d="M332.72888335542086,42.73892776491077L341.68103924167156,32.63403266460091A90,90,0,1,1,192.6562013311751,110.84830122297903L206.05777113149887,109.22105603953219A76.5,76.5,0,1,0,332.72888335542086,42.73892776491077" stroke="#ffffff" stroke-width="1" fill="#5c6fda"></path></g><g><g><g><text text-anchor="end" x="535" y="20.491718170580963" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#6d90cb">Links</text></g><g><text text-anchor="end" x="535" y="39.90828182941904" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#9e9e9e">11.5%</text></g></g><g><path d="M319.5,26.5L384,26.5L384,26.5L535.5,26.5" stroke="#636363" stroke-width="1" stroke-opacity="0.7" fill-opacity="1" fill="none"></path><circle cx="319.5" cy="26.5" r="2" stroke="none" stroke-width="0" fill-opacity="0.7" fill="#636363"></circle></g><g><g><text text-anchor="end" x="535" y="168.49171817058095" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#6d90cb">Pictures</text></g><g><text text-anchor="end" x="535" y="187.90828182941902" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#9e9e9e">61.5%</text></g></g><g><path d="M321.5,174.5L384,174.5L384,174.5L535.5,174.5" stroke="#636363" stroke-width="1" stroke-opacity="0.7" fill-opacity="1" fill="none"></path><circle cx="321.5" cy="174.5" r="2" stroke="none" stroke-width="0" fill-opacity="0.7" fill="#636363"></circle></g><g><g><text text-anchor="start" x="28" y="54.49171817058097" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#6d90cb">Videos</text></g><g><text text-anchor="start" x="28" y="73.90828182941904" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#9e9e9e">23.1%</text></g></g><g><path d="M209.5,60.5L180,60.5L180,60.5L28.5,60.5" stroke="#636363" stroke-width="1" stroke-opacity="0.7" fill-opacity="1" fill="none"></path><circle cx="209.5" cy="60.5" r="2" stroke="none" stroke-width="0" fill-opacity="0.7" fill="#636363"></circle></g><g><g><text text-anchor="start" x="28" y="19.491718170580963" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#6d90cb">Status</text></g><g><text text-anchor="start" x="28" y="38.90828182941904" font-family="Arial" font-size="12" stroke="none" stroke-width="0" fill="#9e9e9e">3.8%</text></g></g><g><path d="M268.5,18.5L180,18.5L180,25.5L28.5,25.5" stroke="#636363" stroke-width="1" stroke-opacity="0.7" fill-opacity="1" fill="none"></path><circle cx="268.5" cy="18.5" r="2" stroke="none" stroke-width="0" fill-opacity="0.7" fill="#636363"></circle></g></g><g></g></svg><div aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;"><table><thead><tr><th>Status</th><th>Wert</th></tr></thead><tbody><tr><td>Links</td><td>3</td></tr><tr><td>Pictures</td><td>16</td></tr><tr><td>Videos</td><td>6</td></tr><tr><td>Status</td><td>1</td></tr></tbody></table></div></div></div><div aria-hidden="true" style="display: none; position: absolute; top: 210px; left: 573px; white-space: nowrap; font-family: Arial; font-size: 12px;">3.8%</div><div></div></div></div>
<div id="control9566356"></div>
</div>
<div id="id13ad" style="display:none"></div>
</div>
<script type="text/javascript"> var chart9566356; var data9566356;var options9566356;
var vAxisFormat9566356 = 'decimal';function drawVisualization9566356() {options9566356 = {curveType: 'none', fontName: 'Arial', 'lineWidth':2, 'height':200, backgroundColor: { fill: 'transparent' },'legend': {'position': 'labeled', 'alignment': 'center' , textStyle: {color: '#6d90cb'}}, chartArea: { },tooltip :{ isHtml : 'true'},'interpolateNulls' : true, pieHole: 0.85, pieSliceText: 'none', chartArea: { width: '90%', height: '90%', left: '5%', top: '5%' }, series: {0: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},1: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},2: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},3: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0} }, vAxes: { 0: {format: 'decimal'}, 1: {format: 'decimal'} },colors: ['#c2185b','#5c6fda','#8ecbd3','#f57c00'],animation:{ duration: 500, easing: 'out', },hAxis:{ textStyle: { },gridlines: {color: 'transparent'},'baselineColor': '#ccc'},vAxis: {format: vAxisFormat9566356, textStyle: { },gridlines: {color: 'transparent'},'baselineColor': '#ccc'} };
chart9566356 = new google.visualization.PieChart(document.getElementById('chartDiv9566356'));
data9566356 = new google.visualization.DataTable();data9566356.addColumn('string', 'Status'); data9566356.addColumn('number', 'Wert');data9566356.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); data9566356.addColumn({type:'string', role:'annotationText'}); data9566356.addColumn({type:'string', role:'annotationText'}); data9566356.addColumn({type:'string', role:'annotationText'}); data9566356.addRows([['Links',3.0,'<div class="name">Links</div><div class="value">3</div>',null,'0','link'],['Pictures',16.0,'<div class="name">Pictures</div><div class="value">16</div>',null,'0','photo'],['Videos',6.0,'<div class="name">Videos</div><div class="value">6</div>',null,'0','video'],['Status',1.0,'<div class="name">Status</div><div class="value">1</div>',null,'0','status']]);
var numberFormatter = new google.visualization.NumberFormat({ fractionDigits: 0 }); for (var i = 1; i < data9566356.getNumberOfColumns(); i++) { if(data9566356.getColumnType(i) === "number"){ numberFormatter.format(data9566356, i); }}
var selectListener9566356 = google.visualization.events.addListener(chart9566356, 'select',function(){ var selection = chart9566356.getSelection(); for (var i = 0; i < selection.length; i++) { var item = selection[i]; if (item.row != null && item.column != null) {var idsColumnNumber = item.column +2;var id = data9566356.getValue(item.row, idsColumnNumber);if(id != null) { id = id.replace('#', ''); } Wicket.Ajax.get({ u: './ClashofClans?38-1.IBehaviorListener.0-fanPageKarmaPanel-resultContainer-graphenPanel-graphenTimesAndTypesPanelContainer-graphenTimesAndTypesPanel-content-postTypePanel-postTypePanel'+'&id='+id+'&datum='+data9566356.getValue(item.row, idsColumnNumber+1)+'&anzahl='+data9566356.getValue(item.row, item.column)+'&page_identifier='+data9566356.getValue(item.row, idsColumnNumber+2)+'&spalte='+item.column}); } else { try {var id = data9566356.getValue(item.row, 7); Wicket.Ajax.get({ u: './ClashofClans?38-1.IBehaviorListener.0-fanPageKarmaPanel-resultContainer-graphenPanel-graphenTimesAndTypesPanelContainer-graphenTimesAndTypesPanel-content-postTypePanel-postTypePanel'+'&id='+id+'&page_identifier='+id}); } catch(e) { var id = data9566356.getValue(item.row, 5); Wicket.Ajax.get({ u: './ClashofClans?38-1.IBehaviorListener.0-fanPageKarmaPanel-resultContainer-graphenPanel-graphenTimesAndTypesPanelContainer-graphenTimesAndTypesPanel-content-postTypePanel-postTypePanel'+'&id='+id+'&page_identifier='+id}); } } } });placeMarker9566356 = function(graph , dataTable) {
};placeMarkerListener9566356 = google.visualization.events.addListener(chart9566356
, 'ready',placeMarker9566356.bind(chart9566356
, chart9566356
, data9566356));
chart9566356.draw(data9566356,options9566356);}function reDrawChart9566356() { if (!$('#chartDiv9566356').is(':visible')) { return; } google.visualization.events.removeListener(placeMarkerListener9566356);
placeMarkerListener9566356 = google.visualization.events.addListener(chart9566356
, 'ready', placeMarker9566356.bind(chart9566356
, chart9566356
, data9566356));
options9566356 = {curveType: 'none', fontName: 'Arial', 'lineWidth':2, 'height':200, backgroundColor: { fill: 'transparent' },'legend': {'position': 'labeled', 'alignment': 'center' , textStyle: {color: '#6d90cb'}}, chartArea: { },tooltip :{ isHtml : 'true'},'interpolateNulls' : true, pieHole: 0.85, pieSliceText: 'none', chartArea: { width: '90%', height: '90%', left: '5%', top: '5%' }, series: {0: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},1: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},2: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0},3: {targetAxisIndex: 0,areaOpacity :1.0,type: 'area',dataOpacity :1.0} }, vAxes: { 0: {format: 'decimal'}, 1: {format: 'decimal'} },colors: ['#c2185b','#5c6fda','#8ecbd3','#f57c00'],animation:{ duration: 500, easing: 'out', },hAxis:{ textStyle: { },gridlines: {color: 'transparent'},'baselineColor': '#ccc'},vAxis: {format: vAxisFormat9566356, textStyle: { },gridlines: {color: 'transparent'},'baselineColor': '#ccc'} };
chart9566356.draw(data9566356,options9566356);}$('body').off('redrawAfterResize.chart9566356').on('redrawAfterResize.chart9566356', function() { reDrawChart9566356(); }); if (typeof googleChartApiLoaded !== 'undefined' && googleChartApiLoaded) { drawVisualization9566356();} else { google.setOnLoadCallback(drawVisualization9566356);}</script>
</div>
</div>
<p class="chart-footer-note">Here you can see the mixture of post types. Find out which types of posts are used most often in the selected time period. Generally speaking, it is good advice to try out all post types and entertain fans with a good mixture.</p>
</div>
</span>
Please, does anyone know how to scrape this?
You can gather all the td elements and loop testing for presence of the word Pictures then take node at next index:
Dim list As Object, i As Long
Set list = doc.querySelectorAll(".chart-content-container td")
For i = 0 To list.Length - 1
If Trim$(list.Item(i).innerText) = "Pictures" Then
Debug.Print list.Item(i + 1).innerText
Exit For
End If
Next
Related
SVG mask used in SVG embedded in HTML document not working
I am making an HTML document version of a griefer list for Dredark.io because the ship I made that had the list was ruined. An idiot I thought was my friend went promoting everyone who joined to captain rank and they all messed EVERYTHING up. However, I am having issues with the portion that shows the last seen appearance of each griefer: the SVG mask="url(#face/body/legs/hand)" attribute is not working. <!DOCTYPE html> <html> <head> <title>Dredark.io Griefers</title> <script> var list = { "clown": { warning: 15, hair: "none", skin: "#ff8800", shirt: "#111111", pants: "#000000", proof: "Many people know him as a griefer" }, "SMARTLABRAT": { warning: 1, hair: "none", skin: "#ffeeaa", shirt: "#11aa11", pants: "#1122aa", proof: "none" } }; function load(){ var max = 0; var sorted = []; for(var prop in list){ if(list[prop].warning >= max){ max = list[prop].warning; } } var cur = max; for(var i = max; i > 0; i--){ for(var prop in list){ if(list[prop].warning == i){ sorted.push(prop); } } } var html = ""; var warningColors = ["#00ff00","#44ff00","#88ff00","#aaff00","#ffff00","#ffaa00","#ff8800","#ff4400","#ff0000"]; for(var i = 0; i < sorted.length; i++){ var color = ""; for(var j = 0; j < warningColors.length; j++){ if(list[sorted[i]].warning >= (j * 10)){ color = warningColors[j]; } } html = "<tr><td>" + (i + 1) + "</td><td>" + sorted[i] + "</td><td style='background: " + color + ";'>" + list[sorted[i]].warning + "</td><td>" + list[sorted[i]].proof + "</td><td>" + document.getElementById("skin").outerHTML.replace(/!----/g,"#00ff00").replace("!_---","#222222").replace("!-_--","#111111") + "</td></tr>"; document.getElementById("list").innerHTML += html; } } window.onload = function(){ load(); }; </script> <style> #list{ border: 1px solid #004400; } #prototypes{ display: none; } </style> </head> <body> <details> <summary>Because the previous one was ruined</summary> <p>by <b>La Danse Macabre</b>, someone I trusted.</p> <details> <summary>Note to <b>La Danse Macabre</b>:</summary> <p>Do not promote random people to <u>Captain</u> on <b>MY</b> ships!</p> </details> </details> <p>The warning level of a griefer depends on how many ships they griefed and how much hard work is lost to them per ship. Griefers with a level below <code>20</code> are not really that bad and can still be trusted. Griefers with a level of less than <code>5</code> mean that they are possible but not proven.</p> <div id="prototypes"> <svg id='skin' xmlns='http://www.w3.org/2000/svg' width='50px' height='80px' viewbox='0 0 50 80'> <defs> <mask maskContentUnits="userSpaceOnUse" id="face" width="50" height="80" viewbox="0 0 50 80"><image href="https://test.drednot.io/img/player_head.png" x="0" y="0"/></mask> <mask maskContentUnits="userSpaceOnUse" id="body"><image href="https://test.drednot.io/img/player.png" x="17" y="7"/> <image href="https://test.drednot.io/img/player_arm.png" x="20" y="-5"/></mask> <mask maskContentUnits="userSpaceOnUse" id="legs"><image href="https://test.drednot.io/img/player_leg.png" x="17" y="8"/> <image href="https://test.drednot.io/img/player_leg.png" x="20" y="8"/></mask> <mask maskContentUnits="userSpaceOnUse" id="hand"><image href="https://test.drednot.io/img/player_hand.png" x="19" y="-5"/></mask> </defs> <rect x="0" y="0" width="100" height="100" fill="!----" mask="url(#face)"/> <rect x="0" y="0" width="100" height="100" fill="!_---" mask="url(#body)"/> <rect x="0" y="0" width="100" height="100" fill="!-_--" mask="url(#legs)"/> <rect x="0" y="0" width="100" height="100" fill="!----" mask="url(#hand)"/> <image href="https://test.drednot.io/img/player_face.png" x="0" y="0"/> <image href="https://test.drednot.io/img/player_foot.png" x="17" y="8"/> <image href="https://test.drednot.io/img/player_foot.png" x="20" y="8"/> </svg> </div> <table id="list" border="1" cellSpacing="0px"> <tr> <th>#</th> <th>Name</th> <th>Warning level</th> <th>Proof</th> <th>Last seen appearance</th> </tr> </table> </body> </html> As its own file, the SVG image DOES support it, but for some reason when I embed it within the HTML document it just stops working. The best I can do is make the whole thing disappear. I have tried everything and I have been searching the whole web for a fix but I have lost all hope other than you kind people. What am I doing wrong and how do I fix this?
Svg <mask> won't be applied, if your svg containing it is hidden via display: none. But you can hide it like so #prototypes { position: absolute; width.0; height: 0; overflow: hidden; } This also applies to other svg elements like <clipPath> or filters. So It's actually a better practice to hide your svg containing all assets and definitions this way. Workin example var list = { "clown": { warning: 15, hair: "none", skin: "#ff8800", shirt: "#111111", pants: "#000000", proof: "Many people know him as a griefer" }, "SMARTLABRAT": { warning: 1, hair: "none", skin: "#ffeeaa", shirt: "#11aa11", pants: "#1122aa", proof: "none" } }; function load() { var max = 0; var sorted = []; for (var prop in list) { if (list[prop].warning >= max) { max = list[prop].warning; } } var cur = max; for (var i = max; i > 0; i--) { for (var prop in list) { if (list[prop].warning == i) { sorted.push(prop); } } } var html = ""; var warningColors = ["#00ff00", "#44ff00", "#88ff00", "#aaff00", "#ffff00", "#ffaa00", "#ff8800", "#ff4400", "#ff0000"]; for (var i = 0; i < sorted.length; i++) { var color = ""; for (var j = 0; j < warningColors.length; j++) { if (list[sorted[i]].warning >= (j * 10)) { color = warningColors[j]; } } html = "<tr><td>" + (i + 1) + "</td><td>" + sorted[i] + "</td><td style='background: " + color + ";'>" + list[sorted[i]].warning + "</td><td>" + list[sorted[i]].proof + "</td><td>" + document.getElementById("skin").outerHTML.replace(/!----/g, "#00ff00").replace("!_---", "#222222").replace("!-_--", "#111111") + "</td></tr>"; document.getElementById("list").innerHTML += html; } } window.onload = function() { load(); }; #list { border: 1px solid #004400; } #prototypes { position: absolute; width.0; height: 0; overflow: hidden; } <details> <summary>Because the previous one was ruined</summary> <p>by <b>La Danse Macabre</b>, someone I trusted.</p> <details> <summary>Note to <b>La Danse Macabre</b>:</summary> <p>Do not promote random people to <u>Captain</u> on <b>MY</b> ships!</p> </details> </details> <p>The warning level of a griefer depends on how many ships they griefed and how much hard work is lost to them per ship. Griefers with a level below <code>20</code> are not really that bad and can still be trusted. Griefers with a level of less than <code>5</code> mean that they are possible but not proven.</p> <div id="prototypes"> <svg aria-hidden="true" id='skin' xmlns='http://www.w3.org/2000/svg' width='50px' height='80px' viewbox='0 0 50 80'> <defs> <mask maskContentUnits="userSpaceOnUse" id="face" width="50" height="80" viewbox="0 0 50 80"><image href="https://test.drednot.io/img/player_head.png" x="0" y="0"/></mask> <mask maskContentUnits="userSpaceOnUse" id="body"><image href="https://test.drednot.io/img/player.png" x="17" y="7"/> <image href="https://test.drednot.io/img/player_arm.png" x="20" y="-5"/></mask> <mask maskContentUnits="userSpaceOnUse" id="legs"><image href="https://test.drednot.io/img/player_leg.png" x="17" y="8"/> <image href="https://test.drednot.io/img/player_leg.png" x="20" y="8"/></mask> <mask maskContentUnits="userSpaceOnUse" id="hand"><image href="https://test.drednot.io/img/player_hand.png" x="19" y="-5"/></mask> </defs> <rect x="0" y="0" width="100" height="100" fill="!----" mask="url(#face)"/> <rect x="0" y="0" width="100" height="100" fill="!_---" mask="url(#body)"/> <rect x="0" y="0" width="100" height="100" fill="!-_--" mask="url(#legs)"/> <rect x="0" y="0" width="100" height="100" fill="!----" mask="url(#hand)"/> <image href="https://test.drednot.io/img/player_face.png" x="0" y="0"/> <image href="https://test.drednot.io/img/player_foot.png" x="17" y="8"/> <image href="https://test.drednot.io/img/player_foot.png" x="20" y="8"/> </svg> </div> <table id="list" border="1" cellSpacing="0px"> <tr> <th>#</th> <th>Name</th> <th>Warning level</th> <th>Proof</th> <th>Last seen appearance</th> </tr> </table>
SVG change clipPath background color
I want to create a landing page, with a colored div and with a clip-path in it, in order to show a video running in the background. For now, the background appears greyish for a reason I don't get. I tried multiple things and I can't get it working. Here is my code : .video_home_container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; } .video_home_background { background: green; position: absolute; top: 0; left: 0; z-index: 11; width: 100vw; height: 100vh; clip-path: url(#mask); } .video { position: relative; z-index: 5; } .video_home_overlay_logo { position: absolute; top: 0; left: 0; z-index: 7; max-width: 100%; height: 100%; } .video_home_overlay_logo path { transform: scale(.8) translateY(40%); } <div class="video_home_container"> <div class="video_home_background"> <video class="video" autoplay loop width="100%"> <source src="<?php echo get_template_directory_uri(); ?>/static/home.mp4" type="video/mp4"> </video> </div> <svg class="video_home_overlay_logo" width="100%" height="100%" > <clipPath id="mask"> <path d="M587.505 411.454H487.962V312.839H587.505V213.814H487.962V115.145H587.505V11.1746H352.65V498.674L587.505 480.804V411.454Z" fill="black"/> <path d="M767.851 437.958H816.106L818.101 463.206L949.97 453.124L884.39 11.1746H688.473L626.664 477.88L765.282 467.305L767.851 437.958ZM791.924 126.976C798.809 213.814 805.695 286.68 812.581 345.574H765.856C769.545 299.641 778.043 226.684 791.924 126.976Z" fill="black"/> <path d="M1650.44 343.198V304.479H1515.13V388.065C1515.13 396.481 1514.91 403.422 1514.69 409.925L1648.58 399.706C1649.92 383.12 1650.44 364.648 1650.44 343.198Z" fill="black"/> <path d="M1465.8 393.175V151.351C1465.8 124.792 1467.42 107.796 1470.5 99.7077C1473.59 91.6196 1480.48 88.122 1491.63 88.122C1501.43 88.122 1507.83 91.3464 1510.92 97.7404C1514 104.134 1515.12 120.748 1515.12 146.679V255.568H1650.44V188.048C1650.44 139.465 1646.39 103.724 1638.3 80.8264C1630.11 58.1469 1613.11 38.6917 1587.21 22.8434C1561.11 7.92411 1528.24 0 1488.56 0C1459.16 0 1433.1 4.94583 1410.66 14.7554C1387.9 25.0295 1370.08 38.6918 1357.54 55.961C1345.28 71.7054 1337.34 90.3858 1334.54 110.146C1331.8 128.863 1330.55 157.117 1330.55 194.524V346.723C1330.23 372.486 1331.77 398.238 1335.16 423.778L1466.32 413.75C1466.08 407.629 1465.8 401.044 1465.8 393.175Z" fill="black"/> <path d="M1824.8 11.1746H1689.57V318.987C1689.57 351.175 1689.87 376.888 1690.69 396.589L1824.8 386.369V11.1746Z" fill="black"/> <path d="M1999.23 11.1746H1863.98V383.337L1999.23 373.035V11.1746Z" fill="black"/> <path d="M2334.43 115.145V11.1746H2038.34V115.145H2118.51V363.69L2253.82 353.607V115.145H2334.43Z" fill="black"/> <path d="M1117.09 296.635H1124.63C1143.27 296.635 1154.69 299.805 1159.06 306.855C1163.27 312.948 1165.59 328.25 1165.89 352.514C1165.89 354.208 1165.89 425.17 1165.89 436.674L1291.58 427.083V394.294C1291.58 352.268 1290.46 326.528 1288.25 317.293C1284.93 305.884 1279.04 295.387 1271.04 286.607C1261.58 275.349 1243.56 266.441 1216.96 259.884C1246.42 256.96 1266.34 248.626 1276.31 234.69C1286.28 220.755 1291.45 193.539 1291.45 153.044C1291.45 108.669 1284.26 76.2892 1270.24 56.0416C1256.23 35.794 1237.45 22.8422 1214.77 17.9784C1192.1 13.1146 1149 11.1746 1085.04 11.1746H989.237V450.145L1117.09 440.39V296.635ZM1117.09 99.8977H1124.63C1140.18 99.8977 1151.27 102.33 1156.96 107.822C1162.8 112.686 1165.73 122.741 1165.89 138.671V172.964C1165.54 193.512 1162.48 205.426 1156.96 209.224C1150.53 213.732 1140.01 215.7 1124.63 215.7H1117.09V99.8977Z" fill="black"/> <path d="M288.084 503.674C297.204 494.512 303.729 483.093 306.993 470.584C311.173 454.791 313.551 423.613 313.551 376.724V194.523C313.551 145.12 311.938 111.921 308.714 95.3892C305.688 78.3871 298.062 62.5389 286.663 49.5657C274.613 35.9034 256.879 26.0119 233.926 19.5086C210.755 13.7431 166.735 11.0652 101.375 11.0652H0V525.643L288.084 503.674ZM128.781 99.7885H135.312C150.395 99.7885 160.396 101.401 165.369 104.625C168.052 106.178 170.376 108.281 172.189 110.796C174.002 113.311 175.263 116.18 175.889 119.216C177.477 130.072 178.199 141.036 178.048 152.006V378.691C177.556 406.508 175.315 423.75 171.435 430.608C166.926 438.286 155.259 442.358 135.312 442.358H128.781V99.7885Z" fill="black"/> </clipPath> </svg> </div> What would you advise me to do ? I'm beginning with svg clip path so I don't get everything.
I suspect that what you are seeing is just a tiny part of the video. This is how I would do it: For the clippath I'm using clipPathUnits="objectBoundingBox" objectBoundingBox This value indicates that all coordinates inside the element are relative to the bounding box of the element the clipping path is applied to. It means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are considered to have a length of 1 unit value. In order to make it having a length of 1 unit value I'm scaling it transform="scale(0.0004)" In order to get this value (0.0004) you need first to get the bounding box of the elements inside the clipping path and divie 1 by the width: 1 / clip.getBBox().width .video_home_background { background: green; width: 100vw; clip-path: url(#clip); } <svg class="video_home_overlay_logo" width="0" height="0" > <clipPath id="clip" clipPathUnits="objectBoundingBox" transform="scale(0.0004)"> <path d="M587.505 411.454H487.962V312.839H587.505V213.814H487.962V115.145H587.505V11.1746H352.65V498.674L587.505 480.804V411.454Z" fill="black"/> <path d="M767.851 437.958H816.106L818.101 463.206L949.97 453.124L884.39 11.1746H688.473L626.664 477.88L765.282 467.305L767.851 437.958ZM791.924 126.976C798.809 213.814 805.695 286.68 812.581 345.574H765.856C769.545 299.641 778.043 226.684 791.924 126.976Z" fill="black"/> <path d="M1650.44 343.198V304.479H1515.13V388.065C1515.13 396.481 1514.91 403.422 1514.69 409.925L1648.58 399.706C1649.92 383.12 1650.44 364.648 1650.44 343.198Z" fill="black"/> <path d="M1465.8 393.175V151.351C1465.8 124.792 1467.42 107.796 1470.5 99.7077C1473.59 91.6196 1480.48 88.122 1491.63 88.122C1501.43 88.122 1507.83 91.3464 1510.92 97.7404C1514 104.134 1515.12 120.748 1515.12 146.679V255.568H1650.44V188.048C1650.44 139.465 1646.39 103.724 1638.3 80.8264C1630.11 58.1469 1613.11 38.6917 1587.21 22.8434C1561.11 7.92411 1528.24 0 1488.56 0C1459.16 0 1433.1 4.94583 1410.66 14.7554C1387.9 25.0295 1370.08 38.6918 1357.54 55.961C1345.28 71.7054 1337.34 90.3858 1334.54 110.146C1331.8 128.863 1330.55 157.117 1330.55 194.524V346.723C1330.23 372.486 1331.77 398.238 1335.16 423.778L1466.32 413.75C1466.08 407.629 1465.8 401.044 1465.8 393.175Z" fill="black"/> <path d="M1824.8 11.1746H1689.57V318.987C1689.57 351.175 1689.87 376.888 1690.69 396.589L1824.8 386.369V11.1746Z" fill="black"/> <path d="M1999.23 11.1746H1863.98V383.337L1999.23 373.035V11.1746Z" fill="black"/> <path d="M2334.43 115.145V11.1746H2038.34V115.145H2118.51V363.69L2253.82 353.607V115.145H2334.43Z" fill="black"/> <path d="M1117.09 296.635H1124.63C1143.27 296.635 1154.69 299.805 1159.06 306.855C1163.27 312.948 1165.59 328.25 1165.89 352.514C1165.89 354.208 1165.89 425.17 1165.89 436.674L1291.58 427.083V394.294C1291.58 352.268 1290.46 326.528 1288.25 317.293C1284.93 305.884 1279.04 295.387 1271.04 286.607C1261.58 275.349 1243.56 266.441 1216.96 259.884C1246.42 256.96 1266.34 248.626 1276.31 234.69C1286.28 220.755 1291.45 193.539 1291.45 153.044C1291.45 108.669 1284.26 76.2892 1270.24 56.0416C1256.23 35.794 1237.45 22.8422 1214.77 17.9784C1192.1 13.1146 1149 11.1746 1085.04 11.1746H989.237V450.145L1117.09 440.39V296.635ZM1117.09 99.8977H1124.63C1140.18 99.8977 1151.27 102.33 1156.96 107.822C1162.8 112.686 1165.73 122.741 1165.89 138.671V172.964C1165.54 193.512 1162.48 205.426 1156.96 209.224C1150.53 213.732 1140.01 215.7 1124.63 215.7H1117.09V99.8977Z" fill="black"/> <path d="M288.084 503.674C297.204 494.512 303.729 483.093 306.993 470.584C311.173 454.791 313.551 423.613 313.551 376.724V194.523C313.551 145.12 311.938 111.921 308.714 95.3892C305.688 78.3871 298.062 62.5389 286.663 49.5657C274.613 35.9034 256.879 26.0119 233.926 19.5086C210.755 13.7431 166.735 11.0652 101.375 11.0652H0V525.643L288.084 503.674ZM128.781 99.7885H135.312C150.395 99.7885 160.396 101.401 165.369 104.625C168.052 106.178 170.376 108.281 172.189 110.796C174.002 113.311 175.263 116.18 175.889 119.216C177.477 130.072 178.199 141.036 178.048 152.006V378.691C177.556 406.508 175.315 423.75 171.435 430.608C166.926 438.286 155.259 442.358 135.312 442.358H128.781V99.7885Z" fill="black"/> </clipPath> </svg> <div class="video_home_background"> <video class="video" width="100%" muted autoplay loop> <source type="video/mp4" src="https://www.w3schools.com/tags/movie.mp4" type="video/mp4"> </video> </div>
my addEventListener click function isnt working
Second click function wont run and i am unsure why. The first one runs fine and does what it should but the second should allow the user to click on the circle that appears and have an info box show up, but nothing will click im assuming to make said info box appear! I did not add all the html ass there is a lot of paths. Im confused as to why the first one woukd work fne but the second doesnt. <head> <meta charset="UTF-8"> <title>POLLENATORS PRESENTATION INFOGRAPHIC APP</title> <!-- main css --> <link href="css/main.css" rel="stylesheet" type="text/css"> <!-- load jquery --> <script src="js/jquery-latest.min.js"></script> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1367 769"> <title>pollen</title> <!-- BACKGROUND --> <g id="background"> </g> <!-- CLOUDS --> <g id="clouds"> </g> <!-- FLOWER ANIMATION AND CLICK --> <g id="flower"> </g> <!-- FLOWER PETAL INFO --> <g id="flowerPetal"> </g> <!-- FLOWER PETAL INFO BUTTON --> <g id="petalBut"> </g> <!-- FLOWER LEAVES INFO --> <g id="flowerLeaves"> </g> <!-- FLOWER LEAVES INFO BUTTON --> <g id="leafBut"> </g> <!-- FLOWER FRUIT INFO --> <g id="flowerFruit"> </g> <!-- FLOWER FRUIT INFO BUTTON --> <g id="fruitBut"> </g> <!-- FLOWER STEM INFO --> <g id="flowerStem"> </g> <!-- FLOWER STEM INFO BUTTON --> <g id="stemBut"> </g> <!-- FLOWER SEEDS INFO --> <g id="flowerSeeds"> </g> <!-- FLOWR SEED INFO BUTTON --> <g id="seedBut"> </g> <!-- FLOWER ROOTS INFO --> <g id="flowerRoots"> </g> <!-- FLOWER ROOTS INFO BUTTON --> <g id="rootBut"> </g> <!-- BEE ANIMATION --> <g id="bee"> </g> <!-- BAT ANIMATION --> <g id="bat"> </g> <!-- BUTTERFLY ANIMATION --> <g id="butterfly"> </g> <!-- TEXT SPEECH --> <g id="textSpeech"> </g> <!-- SPIDER ANIMATION AND CLICK --> <g id="spider"> </g> <!-- MAIN FLOWER INFO --> <g id="flowerInfo"> </g> <!-- SNAIL ANIMATION --> <g id="snail"> </g> <!-- CLICK FLOWER INSTRUCTIONS --> <g id="clickFlower"> </g> <!-- TEXT SPEECH 1 --> <g id="textSpeech1"> </g> <!-- TEXT SPEECH 2 --> <g id="textSpeech2"> </g> <!-- TEXT SPEECH 3 --> <g id="textSpeech3"> </g> <!-- TEXT SPEECH 4 --> <g id="textSpeech4"> </g> <!-- TEXT SPEECH 5 --> <g id="textSpeech5"> </g> <!-- TEXT SPEECH 6 --> <g id="textSpeech6"> </g> <!-- TEXT SPEECH 7 --> <g id="textSpeech7"> </g> </svg> <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script> <script src="js/main.js"></script> </body> </html> window.onload = function () { "use strict" var myBee = document.getElementById('bee'); var myBat = document.getElementById('bat'); var mySpider = document.getElementById('spider'); var myFlower = document.getElementById('flower'); var flowerPetal = document.getElementById('flowerPetal'); var petalButton = document.getElementById('petalBut'); var flowerLeaves = document.getElementById('flowerLeaves'); var leafButton = document.getElementById('leafBut'); var flowerFruit = document.getElementById('flowerFruit'); var fruitBut = document.getElementById('fruitBut'); var flowerStem = document.getElementById('flowerStem'); var stemBut = document.getElementById('stemBut'); var flowerSeeds = document.getElementById('flowerSeeds'); var seedBut = document.getElementById('seedBut'); var flowerRoots = document.getElementById('flowerRoots'); var rootBut = document.getElementById('rootBut'); var mySnail = document.getElementById('snail'); var myButter = document.getElementById('butterfly'); var textSpeech = document.getElementById('textSpeech'); var textSpeech1 = document.getElementById('textSpeech1'); var textSpeech2 = document.getElementById('textSpeech2'); var textSpeech3 = document.getElementById('textSpeech3'); var textSpeech4 = document.getElementById('textSpeech4'); var textSpeech5 = document.getElementById('textSpeech5'); var textSpeech6 = document.getElementById('textSpeech6'); var textSpeech7 = document.getElementById('textSpeech7'); var flowerClick = document.getElementById('clickFlower'); var flowerInfo = document.getElementById('flowerInfo'); TweenMax.to(myBee, 0, { opacity: 0 }); TweenMax.to(myFlower, 0, { opacity: 0 }); TweenMax.to(flowerPetal, 0, { opacity: 0 }); TweenMax.to(petalButton, 0, { opacity: 0 }); TweenMax.to(flowerLeaves, 0, { opacity: 0 }); TweenMax.to(leafButton, 0, { opacity: 0 }); TweenMax.to(flowerFruit, 0, { opacity: 0 }); TweenMax.to(fruitBut, 0, { opacity: 0 }); TweenMax.to(flowerStem, 0, { opacity: 0 }); TweenMax.to(stemBut, 0, { opacity: 0 }); TweenMax.to(flowerSeeds, 0, { opacity: 0 }); TweenMax.to(seedBut, 0, { opacity: 0 }); TweenMax.to(flowerRoots, 0, { opacity: 0 }); TweenMax.to(rootBut, 0, { opacity: 0 }); TweenMax.to(myBat, 0, { opacity: 0 }); TweenMax.to(myButter, 0, { opacity: 0 }); TweenMax.to(textSpeech, 0, { opacity: 0 }); TweenMax.to(textSpeech1, 0, { opacity: 0 }); TweenMax.to(textSpeech2, 0, { opacity: 0 }); TweenMax.to(textSpeech3, 0, { opacity: 0 }); TweenMax.to(textSpeech4, 0, { opacity: 0 }); TweenMax.to(textSpeech5, 0, { opacity: 0 }); TweenMax.to(textSpeech6, 0, { opacity: 0 }); TweenMax.to(textSpeech7, 0, { opacity: 0 }); TweenMax.to(flowerClick, 0, { opacity: 0 }); TweenMax.to(mySnail, 0, { opacity: 0 }); TweenMax.from(mySpider, 4, { y: -100 }); TweenMax.to(mySpider, 4, { y: 0 }); TweenMax.from(flowerInfo, 4, { y: -100 }); TweenMax.to(flowerInfo, 4, { y: 0 }); mySpider.addEventListener("click", function () { TweenMax.to(mySpider, 3, { opacity: 0 }); TweenMax.to(flowerInfo, 3, { opacity: 0 }); TweenMax.from(myFlower, 3, { y: 800 }); TweenMax.to(myFlower, 3, { y: -10, opacity: 1 }); TweenMax.from(mySnail, 3, { x: 300, opacity: 1, delay: 2 }); TweenMax.to(mySnail, 3, { x: 20, opacity: 1, delay: 2 }); TweenMax.from(flowerClick, 3, { opacity: 0, delay: 3 }); TweenMax.to(flowerClick, 3, { opacity: 1, delay: 3 }); TweenMax.to(petalButton, 3, { opacity: 1, delay: 3.5, x: 75 }); TweenMax.to(leafButton, 3, { opacity: 1, delay: 3.5, x: 50 }); TweenMax.to(rootBut, 3, { opacity: 1, delay: 3.5, x: 100 }); TweenMax.to(fruitBut, 3, { opacity: 1, delay: 3.5, x: 100 }); TweenMax.to(seedBut, 3, { opacity: 1, delay: 3.5, x: 30 }); TweenMax.to(stemBut, 3, { opacity: 1, delay: 3.5, x: 40 }); }); petalButton.addEventListener("click", function () { TweenMax.to(flowerPetal, 3, { opacity: 1 }); }); };
Animating SVG with CSS and an inner <g> tag is its axis
I've got a small problem that I'm sure is just a simple fix, but I just haven't been able to fix it with how I usually do things. I've created an SVG logo in Sketch, and exported it and just wanted to make a simple loading animation, just rotating circles, one rotating clockwise and one rotating counter-clockwise. This should have been pretty simple, but when I got to the inner circle, it's rotating around a different axis. I put transform-origin: center on it, and it did nothing. I did transform-origin: fill-box and it got it rotating (on its inner axis) in the top left corner, so still not what I wanted. And I've taken the inline transform off, to no avail. The HTML code is here: <div class='loading-screen'> <svg width="62px" height="62px" viewBox="0 0 62 62" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 52.5 (67469) - http://www.bohemiancoding.com/sketch --> <title>Group 11 Copy 9</title> <desc>Created with Sketch.</desc> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Group-11-Copy-9"> <g id="Group-75-Copy" fill="#425563"> <path d="M30.5749355,61.1497976 C29.8994748,61.1497976 29.3519395,60.6028093 29.3519395,59.9280234 L29.3519395,53.2156572 C29.3519395,52.5408713 29.8994748,51.993883 30.5749355,51.993883 C31.2503961,51.993883 31.7979314,52.5408713 31.7979314,53.2156572 L31.7979314,59.9280234 C31.7979314,60.6028093 31.2503961,61.1497976 30.5749355,61.1497976" id="Fill-1"></path> <path d="M38.4886365,60.1022789 C37.8362293,60.2768705 37.1655995,59.8901178 36.9908334,59.2383013 L35.2517331,52.7547123 C35.076967,52.1029569 35.4641064,51.432997 36.1165747,51.2583444 C36.7689819,51.0836918 37.4396118,51.4704444 37.614439,52.1222609 L39.3534781,58.605911 C39.5282442,59.2576664 39.1411049,59.9276263 38.4886365,60.1022789" id="Fill-3"></path> <path d="M45.8315103,57.0489187 C45.2466125,57.3862505 44.498567,57.1860628 44.1608979,56.6017493 L40.801328,50.7886089 C40.4635977,50.2042343 40.6640467,49.4570583 41.2490057,49.1196042 C41.8339035,48.7822724 42.5818878,48.9824601 42.9196181,49.5668347 L46.2791269,55.3799751 C46.6169183,55.9642886 46.4164081,56.7115257 45.8315103,57.0489187" id="Fill-5"></path> <path d="M52.173949,52.1828792 C51.6963079,52.6600431 50.921968,52.6600431 50.4443881,52.1828792 L45.6932934,47.4365309 C45.2156524,46.959367 45.2156524,46.1858007 45.6932934,45.7086979 C46.1708734,45.231534 46.9452133,45.231534 47.4228543,45.7086979 L52.173949,50.4550462 C52.6515901,50.932149 52.6515901,51.7057153 52.173949,52.1828792" id="Fill-7"></path> <path d="M57.0571517,45.8797096 C56.7194825,46.4640231 55.971437,46.6642719 55.3865392,46.3268789 L49.5675856,42.9707264 C48.9826878,42.6332723 48.7822388,41.8860963 49.1199691,41.3017828 C49.4576994,40.7173472 50.2056838,40.5171595 50.7905816,40.8544913 L56.6095352,44.210705 C57.194433,44.5480979 57.3948209,45.295335 57.0571517,45.8797096" id="Fill-9"></path> <path d="M60.0897414,38.5201879 C59.9149141,39.1719433 59.2443454,39.558757 58.5918771,39.3841044 L52.1017433,37.6468026 C51.4493361,37.4722111 51.0621356,36.8022512 51.2369629,36.1504347 C51.4117901,35.4986793 52.08242,35.1118656 52.7348272,35.2865182 L59.2248998,37.02382 C59.8773681,37.1984115 60.2645075,37.8683714 60.0897414,38.5201879" id="Fill-11"></path> <path d="M61.1496508,30.6054126 C61.1496508,31.2801374 60.6020544,31.8271868 59.9266549,31.8271868 L53.2075151,31.8271868 C52.5321156,31.8271868 51.9845192,31.2801374 51.9845192,30.6054126 C51.9845192,29.9306267 52.5321156,29.3836384 53.2075151,29.3836384 L59.9266549,29.3836384 C60.6020544,29.3836384 61.1496508,29.9306267 61.1496508,30.6054126" id="Fill-13"></path> <path d="M-2.4459919e-05,30.6056508 C-2.4459919e-05,29.930865 0.547571977,29.3838767 1.22297149,29.3838767 L7.94211125,29.3838767 C8.61751076,29.3838767 9.1651072,29.930865 9.1651072,30.6056508 C9.1651072,31.2803756 8.61751076,31.827425 7.94211125,31.827425 L1.22297149,31.827425 C0.547571977,31.827425 -2.4459919e-05,31.2803756 -2.4459919e-05,30.6056508" id="Fill-16"></path> <path d="M1.04859673,38.5114766 C0.873769457,37.8596601 1.26096998,37.1897002 1.91337717,37.0151087 L8.40344978,35.2778069 C9.05591812,35.1031543 9.72654795,35.489968 9.90131407,36.1417234 C10.0762025,36.79354 9.68900198,37.4634998 9.03659479,37.6380914 L2.54639987,39.3753932 C1.89399268,39.5500458 1.22336285,39.1632321 1.04859673,38.5114766" id="Fill-19"></path> <path d="M4.10501649,45.8469538 C3.76728615,45.2626403 3.96767404,44.5154032 4.552633,44.1780103 L10.3715866,40.8217966 C10.9564844,40.4844648 11.7044687,40.6846525 12.0421991,41.2690271 C12.3798682,41.8534017 12.1794804,42.6005777 11.5945825,42.9380317 L5.77562896,46.2941843 C5.19066999,46.6315772 4.44268567,46.4313284 4.10501649,45.8469538" id="Fill-21"></path> <path d="M30.574697,0.0610581645 C31.2501577,0.0610581645 31.7976929,0.608046464 31.7976929,1.28283234 L31.7976929,7.99519858 C31.7976929,8.66998446 31.2501577,9.21697276 30.574697,9.21697276 C29.8992363,9.21697276 29.351701,8.66998446 29.351701,7.99519858 L29.351701,1.28283234 C29.351701,0.608046464 29.8992363,0.0610581645 30.574697,0.0610581645" id="Fill-23"></path> <path d="M8.97567736,9.02794597 C9.45331843,8.55078206 10.2276583,8.55078206 10.7052382,9.02794597 L15.4563329,13.7742943 C15.933974,14.2514582 15.933974,15.0250245 15.4563329,15.5021273 C14.978753,15.9792912 14.2044131,15.9792912 13.726772,15.5021273 L8.97567736,10.755779 C8.49803629,10.2786762 8.49803629,9.50510987 8.97567736,9.02794597" id="Fill-25"></path> <path d="M4.09247466,15.3311767 C4.43014384,14.7468021 5.17818932,14.5465533 5.76308713,14.8839463 L11.5820407,18.2401599 C12.1669385,18.5775529 12.3673876,19.3247899 12.0296572,19.9091034 C11.6919269,20.493478 10.9439426,20.6937268 10.3590448,20.3563339 L4.54009118,17.0001202 C3.95519337,16.6627273 3.75480548,15.9154902 4.09247466,15.3311767" id="Fill-27"></path> <path d="M1.05988498,22.6906678 C1.23471225,22.0389124 1.90528093,21.6520987 2.55774927,21.8267513 L9.04788304,23.5640531 C9.70035138,23.7387057 10.0874907,24.4086656 9.91266348,25.060421 C9.7378362,25.7121765 9.06720637,26.0989291 8.41479918,25.9243376 L1.92472657,24.1870358 C1.27225823,24.0123831 0.88511886,23.3424233 1.05988498,22.6906678" id="Fill-29"></path> <path d="M60.1010296,22.6993791 C60.2758569,23.3511345 59.8886564,24.0210944 59.2362492,24.195747 L52.7461766,25.9330488 C52.0937082,26.1076403 51.4230784,25.7208877 51.2483123,25.0691323 C51.0734239,24.4173769 51.4606244,23.747417 52.1130316,23.5727644 L58.6032265,21.8354626 C59.2556337,21.66081 59.9262635,22.0476237 60.1010296,22.6993791" id="Fill-31"></path> <path d="M57.044616,15.3638714 C57.3823463,15.948246 57.1819584,16.695483 56.5969995,17.0328149 L50.7780459,20.3890286 C50.1931481,20.7264215 49.4452249,20.5261727 49.1074334,19.9417981 C48.7697642,19.3574846 48.9701521,18.6102475 49.5550499,18.2728546 L55.3740035,14.916702 C55.9589625,14.5793091 56.7069468,14.7794968 57.044616,15.3638714" id="Fill-33"></path> <path d="M52.1737717,9.02776881 C52.6514127,9.50493272 52.6514127,10.278499 52.1737717,10.7556019 L47.422677,15.5019502 C46.9450359,15.9791141 46.170696,15.9791141 45.6931161,15.5019502 C45.215475,15.0248474 45.215475,14.25122 45.6931161,13.7741171 L50.4442108,9.02776881 C50.9217907,8.55060491 51.6961306,8.55060491 52.1737717,9.02776881" id="Fill-35"></path> <path d="M45.8642316,4.14943833 C46.4491906,4.48683127 46.6496396,5.23406836 46.3119093,5.81838186 L42.9523394,11.6315223 C42.614609,12.2158358 41.8666859,12.4160846 41.2817269,12.0786917 C40.6967679,11.7412987 40.4963801,10.9940616 40.8340492,10.4097481 L44.1936191,4.59660768 C44.5313495,4.01229418 45.2793338,3.81204539 45.8642316,4.14943833" id="Fill-37"></path> <path d="M38.4973565,1.11987821 C39.1498248,1.29453083 39.5369642,1.9644907 39.3621981,2.61624613 L37.623159,9.09989625 C37.4483317,9.75165168 36.7777019,10.1384654 36.1252947,9.96381277 C35.4728264,9.78922124 35.085687,9.11926137 35.2604531,8.46744485 L36.9995533,1.98379473 C37.1743195,1.3320393 37.8449493,0.945225592 38.4973565,1.11987821" id="Fill-39"></path> <path d="M22.6609898,1.1085768 C23.313397,0.933924181 23.9840268,1.32073789 24.158793,1.97249332 L25.8978932,8.45614344 C26.0726593,9.10795996 25.68552,9.77785874 25.0330516,9.95251136 C24.3806444,10.127164 23.7100146,9.74035027 23.5351873,9.08859484 L21.7961482,2.60494472 C21.6213821,1.95318929 22.0085215,1.28322942 22.6609898,1.1085768" id="Fill-49"></path> <path d="M15.3181221,4.16193708 C15.9030199,3.82460523 16.6510654,4.02479293 16.9887346,4.60916752 L20.3483045,10.4222469 C20.6860348,11.0065604 20.4856469,11.7537975 19.9006268,12.0911904 C19.315729,12.4285833 18.5677447,12.2283346 18.2300143,11.6440211 L14.8705056,5.8309417 C14.5327141,5.24656711 14.7332243,4.49933002 15.3181221,4.16193708" id="Fill-51"></path> <path d="M8.97586081,52.1831236 C8.49821974,51.7059597 8.49821974,50.9323323 8.97586081,50.4552905 L13.7269555,45.7089422 C14.2045965,45.2317783 14.9789364,45.2317783 15.4565164,45.7089422 C15.9341574,46.186045 15.9341574,46.9596113 15.4565164,47.4367753 L10.7054217,52.1831236 C10.2278418,52.6602875 9.45350188,52.6602875 8.97586081,52.1831236" id="Fill-53"></path> <path d="M15.2853948,57.0613869 C14.7004358,56.724055 14.4999868,55.9768179 14.8377782,55.3924433 L18.197287,49.5793029 C18.5350173,48.9949894 19.2829405,48.7948017 19.8678994,49.1321335 C20.4528584,49.4695876 20.6532463,50.2167636 20.3155771,50.8010771 L16.9560072,56.6142175 C16.618338,57.1985921 15.8702926,57.3987798 15.2853948,57.0613869" id="Fill-65"></path> <path d="M22.652276,60.090947 C21.9998076,59.9163555 21.6126683,59.2463956 21.7874344,58.5946401 L23.5264735,52.1109289 C23.7013008,51.4591735 24.3719306,51.0723598 25.0243378,51.2470735 C25.6768061,51.421665 26.0639455,52.0916249 25.8891794,52.7433803 L24.1500791,59.2270305 C23.975313,59.8787859 23.3046832,60.2655996 22.652276,60.090947" id="Fill-73"></path> </g> <g id="Group" transform="translate(12.068571, 12.068571)" fill="#FF6900"> <path d="M18.506364,36.2688224 C17.8309034,36.2688224 17.2833681,35.7218341 17.2833681,35.0470483 L17.2833681,31.3817257 C17.2833681,30.7069399 17.8309034,30.1599516 18.506364,30.1599516 C19.1818247,30.1599516 19.72936,30.7069399 19.72936,31.3817257 L19.72936,35.0470483 C19.72936,35.7218341 19.1818247,36.2688224 18.506364,36.2688224" id="Fill-41"></path> <path d="M30.1263727,18.5120575 C30.1263727,17.8372716 30.673908,17.2902833 31.3493686,17.2902833 L35.0183565,17.2902833 C35.6938171,17.2902833 36.2413524,17.8372716 36.2413524,18.5120575 C36.2413524,19.1868434 35.6938171,19.7338317 35.0183565,19.7338317 L31.3493686,19.7338317 C30.673908,19.7338317 30.1263727,19.1868434 30.1263727,18.5120575" id="Fill-43"></path> <path d="M28.560785,24.3360045 C28.8984542,23.7516299 29.6464996,23.5513811 30.2313975,23.8888352 L33.4088632,25.7214964 C33.9938222,26.0588283 34.1942101,26.8060654 33.8565409,27.39044 C33.5187494,27.9747535 32.7708262,28.1750022 32.1858673,27.8376093 L29.0084015,26.004948 C28.4235037,25.6676162 28.2230547,24.920318 28.560785,24.3360045" id="Fill-45"></path> <path d="M24.3010228,28.6082189 C24.8859818,28.2708871 25.6339661,28.4710748 25.9716964,29.0553883 L27.8061904,32.2296798 C28.1439207,32.8140544 27.9434717,33.5612915 27.3585127,33.8986844 C26.7736149,34.2360773 26.0256306,34.0358285 25.6879002,33.451454 L23.8534063,30.2771625 C23.515676,29.692849 23.716125,28.9456119 24.3010228,28.6082189" id="Fill-47"></path> <path d="M18.4956139,0.816643903 C19.1710746,0.816643903 19.7186099,1.3636322 19.7186099,2.03841808 L19.7186099,5.70374061 C19.7186099,6.3784654 19.1710746,6.92551479 18.4956139,6.92551479 C17.8201532,6.92551479 17.272618,6.3784654 17.272618,5.70374061 L17.272618,2.03841808 C17.272618,1.3636322 17.8201532,0.816643903 18.4956139,0.816643903" id="Fill-55"></path> <path d="M8.44118686,12.7494618 C8.10351768,13.3338364 7.35547221,13.5340852 6.77057439,13.1966923 L3.59310861,11.364031 C3.00814965,11.0266381 2.80776176,10.279401 3.14543094,9.69502639 C3.48316127,9.11071289 4.2311456,8.9104641 4.81610456,9.24785704 L7.99357034,11.0805183 C8.57846816,11.4179112 8.77885604,12.1651483 8.44118686,12.7494618" id="Fill-57"></path> <path d="M12.700894,8.47724741 C12.1159962,8.81464035 11.3680119,8.61439156 11.0302815,8.03001697 L9.19578759,4.85578657 C8.85805726,4.27141198 9.0585063,3.5241749 9.64340411,3.18678196 C10.2283631,2.84945011 10.9763474,3.04963781 11.3140777,3.63401239 L13.1485717,6.8082428 C13.486302,7.39261738 13.285853,8.13985447 12.700894,8.47724741" id="Fill-59"></path> <path d="M24.2842983,8.48953846 L24.2842372,8.48953846 C23.6993394,8.15214552 23.4988903,7.40496952 23.8366207,6.82059493 L25.6711146,3.64630344 C26.0088449,3.06192885 26.7568293,2.86174115 27.3417271,3.199073 L27.3417882,3.199073 C27.926686,3.53646594 28.1271351,4.28370303 27.7894047,4.86807762 L25.9549108,8.04236911 C25.6171805,8.6267437 24.8691962,8.8269314 24.2842983,8.48953846" id="Fill-61"></path> <path d="M28.560785,12.7450207 C28.2230547,12.1606461 28.4235037,11.413409 29.0084015,11.0760772 L32.1858673,9.2433548 C32.7708262,8.90602295 33.5187494,9.10621065 33.8565409,9.69058524 C34.1942101,10.2749598 33.9938222,11.0221358 33.4088632,11.3595288 L30.2313975,13.19219 C29.6464996,13.529583 28.8984542,13.3293953 28.560785,12.7450207" id="Fill-63"></path> <path d="M0.772922751,18.5515452 C0.772922751,17.8768204 1.32045804,17.329771 1.9959187,17.329771 L5.66490656,17.329771 C6.34036722,17.329771 6.88790251,17.8768204 6.88790251,18.5515452 C6.88790251,19.2263311 6.34036722,19.7733194 5.66490656,19.7733194 L1.9959187,19.7733194 C1.32045804,19.7733194 0.772922751,19.2263311 0.772922751,18.5515452" id="Fill-67"></path> <path d="M12.7176735,28.5959279 C13.3026325,28.9332597 13.5030815,29.6805579 13.16529,30.2648714 L11.3307961,33.4391629 C10.9931269,34.0235375 10.2451426,34.2237252 9.66018362,33.8863933 C9.0752858,33.5490004 8.87483677,32.8017633 9.2125671,32.2173887 L11.047061,29.0430972 C11.3847302,28.4587837 12.1327757,28.258596 12.7176735,28.5959279" id="Fill-69"></path> <path d="M8.44118686,24.3404762 C8.77885604,24.9247897 8.57846816,25.6720268 7.99357034,26.0094197 L4.81610456,27.842081 C4.2311456,28.1794739 3.48316127,27.9792252 3.14543094,27.3949117 C2.80776176,26.8105371 3.00814965,26.0633 3.59310861,25.725907 L6.77057439,23.8932458 C7.35547221,23.5558528 8.10351768,23.7561016 8.44118686,24.3404762" id="Fill-71"></path> </g> </g> </g> </svg> </div> And the SCSS code is here: * { margin: 0; padding: 0; } .loading-screen { height: 100vh; width: 100vw; background-color: #f3f4f5; position: fixed; z-index: 9999; display: flex; justify-content: center; align-items: center; g#Group-75-Copy { transform-origin: center; animation: backwards-spin 3s infinite linear; } g#Group { transform-origin: center; transform-box: fill-box; animation: spin 3s infinite linear; } } #keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } #keyframes backwards-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } } And here's a link to a working codepen: https://codepen.io/adammcgurk/pen/oJmLxW So the TL;DR question is: How can I get the orange circle to be in the middle as opposed to in the top left corner of the SVG?
I would add some translation to the animation to rectify the position: * { margin: 0; padding: 0; } .loading-screen { height: 100vh; width: 100vw; background-color: #f3f4f5; position: fixed; z-index: 9999; display: flex; justify-content: center; align-items: center; } svg { width: 62px; height: 62px; } g#Group-75-Copy { transform-origin: center; animation: backwards-spin 3s infinite linear; } g#Group { transform-origin: center; transform-box:fill-box; animation: spin 3s infinite linear; } #keyframes spin { 0% { transform:translate(35%,35%) rotate(0deg); } 100% { transform:translate(35%,35%) rotate(360deg); } } #keyframes backwards-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } } <div class='loading-screen'> <svg> <g id="Page-1" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="Group-11-Copy-9"> <g id="Group-75-Copy" fill="#425563"> <path d="M30.5749355,61.1497976 C29.8994748,61.1497976 29.3519395,60.6028093 29.3519395,59.9280234 L29.3519395,53.2156572 C29.3519395,52.5408713 29.8994748,51.993883 30.5749355,51.993883 C31.2503961,51.993883 31.7979314,52.5408713 31.7979314,53.2156572 L31.7979314,59.9280234 C31.7979314,60.6028093 31.2503961,61.1497976 30.5749355,61.1497976" id="Fill-1"></path> <path d="M38.4886365,60.1022789 C37.8362293,60.2768705 37.1655995,59.8901178 36.9908334,59.2383013 L35.2517331,52.7547123 C35.076967,52.1029569 35.4641064,51.432997 36.1165747,51.2583444 C36.7689819,51.0836918 37.4396118,51.4704444 37.614439,52.1222609 L39.3534781,58.605911 C39.5282442,59.2576664 39.1411049,59.9276263 38.4886365,60.1022789" id="Fill-3"></path> <path d="M45.8315103,57.0489187 C45.2466125,57.3862505 44.498567,57.1860628 44.1608979,56.6017493 L40.801328,50.7886089 C40.4635977,50.2042343 40.6640467,49.4570583 41.2490057,49.1196042 C41.8339035,48.7822724 42.5818878,48.9824601 42.9196181,49.5668347 L46.2791269,55.3799751 C46.6169183,55.9642886 46.4164081,56.7115257 45.8315103,57.0489187" id="Fill-5"></path> <path d="M52.173949,52.1828792 C51.6963079,52.6600431 50.921968,52.6600431 50.4443881,52.1828792 L45.6932934,47.4365309 C45.2156524,46.959367 45.2156524,46.1858007 45.6932934,45.7086979 C46.1708734,45.231534 46.9452133,45.231534 47.4228543,45.7086979 L52.173949,50.4550462 C52.6515901,50.932149 52.6515901,51.7057153 52.173949,52.1828792" id="Fill-7"></path> <path d="M57.0571517,45.8797096 C56.7194825,46.4640231 55.971437,46.6642719 55.3865392,46.3268789 L49.5675856,42.9707264 C48.9826878,42.6332723 48.7822388,41.8860963 49.1199691,41.3017828 C49.4576994,40.7173472 50.2056838,40.5171595 50.7905816,40.8544913 L56.6095352,44.210705 C57.194433,44.5480979 57.3948209,45.295335 57.0571517,45.8797096" id="Fill-9"></path> <path d="M60.0897414,38.5201879 C59.9149141,39.1719433 59.2443454,39.558757 58.5918771,39.3841044 L52.1017433,37.6468026 C51.4493361,37.4722111 51.0621356,36.8022512 51.2369629,36.1504347 C51.4117901,35.4986793 52.08242,35.1118656 52.7348272,35.2865182 L59.2248998,37.02382 C59.8773681,37.1984115 60.2645075,37.8683714 60.0897414,38.5201879" id="Fill-11"></path> <path d="M61.1496508,30.6054126 C61.1496508,31.2801374 60.6020544,31.8271868 59.9266549,31.8271868 L53.2075151,31.8271868 C52.5321156,31.8271868 51.9845192,31.2801374 51.9845192,30.6054126 C51.9845192,29.9306267 52.5321156,29.3836384 53.2075151,29.3836384 L59.9266549,29.3836384 C60.6020544,29.3836384 61.1496508,29.9306267 61.1496508,30.6054126" id="Fill-13"></path> <path d="M-2.4459919e-05,30.6056508 C-2.4459919e-05,29.930865 0.547571977,29.3838767 1.22297149,29.3838767 L7.94211125,29.3838767 C8.61751076,29.3838767 9.1651072,29.930865 9.1651072,30.6056508 C9.1651072,31.2803756 8.61751076,31.827425 7.94211125,31.827425 L1.22297149,31.827425 C0.547571977,31.827425 -2.4459919e-05,31.2803756 -2.4459919e-05,30.6056508" id="Fill-16"></path> <path d="M1.04859673,38.5114766 C0.873769457,37.8596601 1.26096998,37.1897002 1.91337717,37.0151087 L8.40344978,35.2778069 C9.05591812,35.1031543 9.72654795,35.489968 9.90131407,36.1417234 C10.0762025,36.79354 9.68900198,37.4634998 9.03659479,37.6380914 L2.54639987,39.3753932 C1.89399268,39.5500458 1.22336285,39.1632321 1.04859673,38.5114766" id="Fill-19"></path> <path d="M4.10501649,45.8469538 C3.76728615,45.2626403 3.96767404,44.5154032 4.552633,44.1780103 L10.3715866,40.8217966 C10.9564844,40.4844648 11.7044687,40.6846525 12.0421991,41.2690271 C12.3798682,41.8534017 12.1794804,42.6005777 11.5945825,42.9380317 L5.77562896,46.2941843 C5.19066999,46.6315772 4.44268567,46.4313284 4.10501649,45.8469538" id="Fill-21"></path> <path d="M30.574697,0.0610581645 C31.2501577,0.0610581645 31.7976929,0.608046464 31.7976929,1.28283234 L31.7976929,7.99519858 C31.7976929,8.66998446 31.2501577,9.21697276 30.574697,9.21697276 C29.8992363,9.21697276 29.351701,8.66998446 29.351701,7.99519858 L29.351701,1.28283234 C29.351701,0.608046464 29.8992363,0.0610581645 30.574697,0.0610581645" id="Fill-23"></path> <path d="M8.97567736,9.02794597 C9.45331843,8.55078206 10.2276583,8.55078206 10.7052382,9.02794597 L15.4563329,13.7742943 C15.933974,14.2514582 15.933974,15.0250245 15.4563329,15.5021273 C14.978753,15.9792912 14.2044131,15.9792912 13.726772,15.5021273 L8.97567736,10.755779 C8.49803629,10.2786762 8.49803629,9.50510987 8.97567736,9.02794597" id="Fill-25"></path> <path d="M4.09247466,15.3311767 C4.43014384,14.7468021 5.17818932,14.5465533 5.76308713,14.8839463 L11.5820407,18.2401599 C12.1669385,18.5775529 12.3673876,19.3247899 12.0296572,19.9091034 C11.6919269,20.493478 10.9439426,20.6937268 10.3590448,20.3563339 L4.54009118,17.0001202 C3.95519337,16.6627273 3.75480548,15.9154902 4.09247466,15.3311767" id="Fill-27"></path> <path d="M1.05988498,22.6906678 C1.23471225,22.0389124 1.90528093,21.6520987 2.55774927,21.8267513 L9.04788304,23.5640531 C9.70035138,23.7387057 10.0874907,24.4086656 9.91266348,25.060421 C9.7378362,25.7121765 9.06720637,26.0989291 8.41479918,25.9243376 L1.92472657,24.1870358 C1.27225823,24.0123831 0.88511886,23.3424233 1.05988498,22.6906678" id="Fill-29"></path> <path d="M60.1010296,22.6993791 C60.2758569,23.3511345 59.8886564,24.0210944 59.2362492,24.195747 L52.7461766,25.9330488 C52.0937082,26.1076403 51.4230784,25.7208877 51.2483123,25.0691323 C51.0734239,24.4173769 51.4606244,23.747417 52.1130316,23.5727644 L58.6032265,21.8354626 C59.2556337,21.66081 59.9262635,22.0476237 60.1010296,22.6993791" id="Fill-31"></path> <path d="M57.044616,15.3638714 C57.3823463,15.948246 57.1819584,16.695483 56.5969995,17.0328149 L50.7780459,20.3890286 C50.1931481,20.7264215 49.4452249,20.5261727 49.1074334,19.9417981 C48.7697642,19.3574846 48.9701521,18.6102475 49.5550499,18.2728546 L55.3740035,14.916702 C55.9589625,14.5793091 56.7069468,14.7794968 57.044616,15.3638714" id="Fill-33"></path> <path d="M52.1737717,9.02776881 C52.6514127,9.50493272 52.6514127,10.278499 52.1737717,10.7556019 L47.422677,15.5019502 C46.9450359,15.9791141 46.170696,15.9791141 45.6931161,15.5019502 C45.215475,15.0248474 45.215475,14.25122 45.6931161,13.7741171 L50.4442108,9.02776881 C50.9217907,8.55060491 51.6961306,8.55060491 52.1737717,9.02776881" id="Fill-35"></path> <path d="M45.8642316,4.14943833 C46.4491906,4.48683127 46.6496396,5.23406836 46.3119093,5.81838186 L42.9523394,11.6315223 C42.614609,12.2158358 41.8666859,12.4160846 41.2817269,12.0786917 C40.6967679,11.7412987 40.4963801,10.9940616 40.8340492,10.4097481 L44.1936191,4.59660768 C44.5313495,4.01229418 45.2793338,3.81204539 45.8642316,4.14943833" id="Fill-37"></path> <path d="M38.4973565,1.11987821 C39.1498248,1.29453083 39.5369642,1.9644907 39.3621981,2.61624613 L37.623159,9.09989625 C37.4483317,9.75165168 36.7777019,10.1384654 36.1252947,9.96381277 C35.4728264,9.78922124 35.085687,9.11926137 35.2604531,8.46744485 L36.9995533,1.98379473 C37.1743195,1.3320393 37.8449493,0.945225592 38.4973565,1.11987821" id="Fill-39"></path> <path d="M22.6609898,1.1085768 C23.313397,0.933924181 23.9840268,1.32073789 24.158793,1.97249332 L25.8978932,8.45614344 C26.0726593,9.10795996 25.68552,9.77785874 25.0330516,9.95251136 C24.3806444,10.127164 23.7100146,9.74035027 23.5351873,9.08859484 L21.7961482,2.60494472 C21.6213821,1.95318929 22.0085215,1.28322942 22.6609898,1.1085768" id="Fill-49"></path> <path d="M15.3181221,4.16193708 C15.9030199,3.82460523 16.6510654,4.02479293 16.9887346,4.60916752 L20.3483045,10.4222469 C20.6860348,11.0065604 20.4856469,11.7537975 19.9006268,12.0911904 C19.315729,12.4285833 18.5677447,12.2283346 18.2300143,11.6440211 L14.8705056,5.8309417 C14.5327141,5.24656711 14.7332243,4.49933002 15.3181221,4.16193708" id="Fill-51"></path> <path d="M8.97586081,52.1831236 C8.49821974,51.7059597 8.49821974,50.9323323 8.97586081,50.4552905 L13.7269555,45.7089422 C14.2045965,45.2317783 14.9789364,45.2317783 15.4565164,45.7089422 C15.9341574,46.186045 15.9341574,46.9596113 15.4565164,47.4367753 L10.7054217,52.1831236 C10.2278418,52.6602875 9.45350188,52.6602875 8.97586081,52.1831236" id="Fill-53"></path> <path d="M15.2853948,57.0613869 C14.7004358,56.724055 14.4999868,55.9768179 14.8377782,55.3924433 L18.197287,49.5793029 C18.5350173,48.9949894 19.2829405,48.7948017 19.8678994,49.1321335 C20.4528584,49.4695876 20.6532463,50.2167636 20.3155771,50.8010771 L16.9560072,56.6142175 C16.618338,57.1985921 15.8702926,57.3987798 15.2853948,57.0613869" id="Fill-65"></path> <path d="M22.652276,60.090947 C21.9998076,59.9163555 21.6126683,59.2463956 21.7874344,58.5946401 L23.5264735,52.1109289 C23.7013008,51.4591735 24.3719306,51.0723598 25.0243378,51.2470735 C25.6768061,51.421665 26.0639455,52.0916249 25.8891794,52.7433803 L24.1500791,59.2270305 C23.975313,59.8787859 23.3046832,60.2655996 22.652276,60.090947" id="Fill-73"></path> </g> <g id="Group" fill="#FF6900"> <path d="M18.506364,36.2688224 C17.8309034,36.2688224 17.2833681,35.7218341 17.2833681,35.0470483 L17.2833681,31.3817257 C17.2833681,30.7069399 17.8309034,30.1599516 18.506364,30.1599516 C19.1818247,30.1599516 19.72936,30.7069399 19.72936,31.3817257 L19.72936,35.0470483 C19.72936,35.7218341 19.1818247,36.2688224 18.506364,36.2688224" id="Fill-41"></path> <path d="M30.1263727,18.5120575 C30.1263727,17.8372716 30.673908,17.2902833 31.3493686,17.2902833 L35.0183565,17.2902833 C35.6938171,17.2902833 36.2413524,17.8372716 36.2413524,18.5120575 C36.2413524,19.1868434 35.6938171,19.7338317 35.0183565,19.7338317 L31.3493686,19.7338317 C30.673908,19.7338317 30.1263727,19.1868434 30.1263727,18.5120575" id="Fill-43"></path> <path d="M28.560785,24.3360045 C28.8984542,23.7516299 29.6464996,23.5513811 30.2313975,23.8888352 L33.4088632,25.7214964 C33.9938222,26.0588283 34.1942101,26.8060654 33.8565409,27.39044 C33.5187494,27.9747535 32.7708262,28.1750022 32.1858673,27.8376093 L29.0084015,26.004948 C28.4235037,25.6676162 28.2230547,24.920318 28.560785,24.3360045" id="Fill-45"></path> <path d="M24.3010228,28.6082189 C24.8859818,28.2708871 25.6339661,28.4710748 25.9716964,29.0553883 L27.8061904,32.2296798 C28.1439207,32.8140544 27.9434717,33.5612915 27.3585127,33.8986844 C26.7736149,34.2360773 26.0256306,34.0358285 25.6879002,33.451454 L23.8534063,30.2771625 C23.515676,29.692849 23.716125,28.9456119 24.3010228,28.6082189" id="Fill-47"></path> <path d="M18.4956139,0.816643903 C19.1710746,0.816643903 19.7186099,1.3636322 19.7186099,2.03841808 L19.7186099,5.70374061 C19.7186099,6.3784654 19.1710746,6.92551479 18.4956139,6.92551479 C17.8201532,6.92551479 17.272618,6.3784654 17.272618,5.70374061 L17.272618,2.03841808 C17.272618,1.3636322 17.8201532,0.816643903 18.4956139,0.816643903" id="Fill-55"></path> <path d="M8.44118686,12.7494618 C8.10351768,13.3338364 7.35547221,13.5340852 6.77057439,13.1966923 L3.59310861,11.364031 C3.00814965,11.0266381 2.80776176,10.279401 3.14543094,9.69502639 C3.48316127,9.11071289 4.2311456,8.9104641 4.81610456,9.24785704 L7.99357034,11.0805183 C8.57846816,11.4179112 8.77885604,12.1651483 8.44118686,12.7494618" id="Fill-57"></path> <path d="M12.700894,8.47724741 C12.1159962,8.81464035 11.3680119,8.61439156 11.0302815,8.03001697 L9.19578759,4.85578657 C8.85805726,4.27141198 9.0585063,3.5241749 9.64340411,3.18678196 C10.2283631,2.84945011 10.9763474,3.04963781 11.3140777,3.63401239 L13.1485717,6.8082428 C13.486302,7.39261738 13.285853,8.13985447 12.700894,8.47724741" id="Fill-59"></path> <path d="M24.2842983,8.48953846 L24.2842372,8.48953846 C23.6993394,8.15214552 23.4988903,7.40496952 23.8366207,6.82059493 L25.6711146,3.64630344 C26.0088449,3.06192885 26.7568293,2.86174115 27.3417271,3.199073 L27.3417882,3.199073 C27.926686,3.53646594 28.1271351,4.28370303 27.7894047,4.86807762 L25.9549108,8.04236911 C25.6171805,8.6267437 24.8691962,8.8269314 24.2842983,8.48953846" id="Fill-61"></path> <path d="M28.560785,12.7450207 C28.2230547,12.1606461 28.4235037,11.413409 29.0084015,11.0760772 L32.1858673,9.2433548 C32.7708262,8.90602295 33.5187494,9.10621065 33.8565409,9.69058524 C34.1942101,10.2749598 33.9938222,11.0221358 33.4088632,11.3595288 L30.2313975,13.19219 C29.6464996,13.529583 28.8984542,13.3293953 28.560785,12.7450207" id="Fill-63"></path> <path d="M0.772922751,18.5515452 C0.772922751,17.8768204 1.32045804,17.329771 1.9959187,17.329771 L5.66490656,17.329771 C6.34036722,17.329771 6.88790251,17.8768204 6.88790251,18.5515452 C6.88790251,19.2263311 6.34036722,19.7733194 5.66490656,19.7733194 L1.9959187,19.7733194 C1.32045804,19.7733194 0.772922751,19.2263311 0.772922751,18.5515452" id="Fill-67"></path> <path d="M12.7176735,28.5959279 C13.3026325,28.9332597 13.5030815,29.6805579 13.16529,30.2648714 L11.3307961,33.4391629 C10.9931269,34.0235375 10.2451426,34.2237252 9.66018362,33.8863933 C9.0752858,33.5490004 8.87483677,32.8017633 9.2125671,32.2173887 L11.047061,29.0430972 C11.3847302,28.4587837 12.1327757,28.258596 12.7176735,28.5959279" id="Fill-69"></path> <path d="M8.44118686,24.3404762 C8.77885604,24.9247897 8.57846816,25.6720268 7.99357034,26.0094197 L4.81610456,27.842081 C4.2311456,28.1794739 3.48316127,27.9792252 3.14543094,27.3949117 C2.80776176,26.8105371 3.00814965,26.0633 3.59310861,25.725907 L6.77057439,23.8932458 C7.35547221,23.5558528 8.10351768,23.7561016 8.44118686,24.3404762" id="Fill-71"></path> </g> </g> </g> </svg> </div>
Pure svg and smil Option using stroke-dasharray We divide one circle into 12 parts, the second circle into 24 parts. Set the circles to a wide stroke. Use the animation of the rotation of circles in different directions .container { width:50%; height:50%; } <div class="container"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 400 400" preserveAspectRatio="xMinYMin meet" > <circle fill="none" cx="200" cy="200" r="50" stroke="#425563" stroke-width="14" stroke-dasharray="4 9.08" > <animateTransform attributeName="transform" type="rotate" dur="2s" values="0 200 200; -360 200 200" repeatCount="indefinite" /> </circle> <circle fill="none" cx="200" cy="200" r="25" stroke="#FF6900" stroke-width="12" stroke-dasharray="4 9.08" > <animateTransform attributeName="transform" type="rotate" dur="2s" values="0 200 200; 360 200 200" repeatCount="indefinite" /> </circle> </svg> </div>
i have Multiple svg elements when mouseover on 1 element all element must be show text hover at a same time
I have Multiple SVG elements when mouseover on 1 element all element must be show text hover at a same time.. How i can do this? Here is my code... <html> <head> <title>conservedClusters_FRAAL_16</title> </head> <body> <svg width="1500" height="500" xmlns="http://www.w3.org/2000/svg" version="1.1"> <style> .tooltip{ font-size: 16px; font-family: Times New Roman; } .tooltip_bg{ fill: white; stroke: black; stroke-width: 1; opacity: 0.9; } </style> <script type="text/ecmascript"> <![CDATA[ function init(evt) { if ( window.svgDocument == null ) { svgDocument = evt.target.ownerDocument; } tooltip = svgDocument.getElementById('tooltip'); tooltip_bg = svgDocument.getElementById('tooltip_bg'); } function ShowTooltip(evt, mouseovertext, xpos, ypos) { tooltip.firstChild.data = mouseovertext; length = tooltip.getComputedTextLength(); if (length + xpos > 1500) { xpos=1500-length-10; } tooltip.setAttributeNS(null,"x",xpos+3); tooltip.setAttributeNS(null,"y",ypos+13); tooltip.setAttributeNS(null,"visibility","visible"); length = tooltip.getComputedTextLength(); tooltip_bg.setAttributeNS(null,"width",length+8); tooltip_bg.setAttributeNS(null,"x",xpos); tooltip_bg.setAttributeNS(null,"y",ypos); tooltip_bg.setAttributeNS(null,"visibility","visibile"); } function HideTooltip(evt) { tooltip.setAttributeNS(null,"visibility","hidden"); tooltip_bg.setAttributeNS(null,"visibility","hidden"); } function writeConsole(content,linkaddress,linktext,winTitle) { top.consoleRef=window.open('','myconsole', '',//'width=350,height=250' +',menubar=0' +',toolbar=1' +',status=0' +',scrollbars=1' +',resizable=1') top.consoleRef.document.writeln( '<html><head><title>'+winTitle+'</title></head>' +'<body bgcolor=white onLoad="self.focus()">' +''+linktext+''+ '<p><font face="courier">'+content+'</font></p>' +'</body></html>' ) top.consoleRef.document.close() } function onGeneMouseOver(evt,strokecolor,colorval) { var gene = evt.target; var parent = gene.parentNode; var others = parent.getElementsByTagName('path'); for (var i=0,len=others.length;i<len;++i) { others[i].style.stroke=strokecolor; others[i].style.fill=colorval; //others[i].setAttribute("style", "stroke-linecap: square; stroke-linejoin: miter; fill:"+colorval+"; stroke:"+strokecolor+"; stroke-width:1"); } } ]]> </script> <g class="all1303" onmouseover="onGeneMouseOver(evt,'red','pink')" onmouseout="onGeneMouseOver(evt,'black','#cf0f78')"> <path id="all" d=" M487 73L423 73L423 63L403 83L423 103L423 93L487 93 L487 73 " style="stroke-linecap: square; stroke-linejoin: miter; fill:#cf0f78; fill-opacity:1.00; stroke:black; stroke-width:1" onmousemove="ShowTooltip(evt, 'FraEuI1c_4753, 1.00, Beta-ketoacyl synthase', 492, 93)" onmouseout="HideTooltip(evt)" /> <path id="all" d=" M257 156L324 156L324 146L344 166L324 186L324 176L257 176 L257 156 " style="stroke-linecap: square; stroke-linejoin: miter; fill:#cf0f78; fill-opacity:1.00; stroke:black; stroke-width:1" onmousemove="ShowTooltip(evt, 'Franean1_2393, 1.00, Beta-ketoacyl synthase', 349, 176)" onmouseout="HideTooltip(evt)" /> </g> <rect class="tooltip_bg" id="tooltip_bg" x="0" y="0" rx="4" ry="4" width="55" height="17" visibility="hidden"/> <text class="tooltip" id="tooltip" x="0" y="0" visibility="hidden">Tooltip</text> </svg> </body> </html>