Update script.js

This commit is contained in:
Elizabeth Hunt 2023-04-30 14:41:32 -06:00 committed by Lizzy Hunt
parent b4b95a18f0
commit 4165705816
Signed by: simponic
GPG Key ID: 52B3774857EB24B1

View File

@ -60,12 +60,9 @@ const drawLogo = (logo, element) => {
element.style.filter = `brightness(0.5) sepia(1) saturate(10000%) hue-rotate(${logo.dColorWheel}rad)`; element.style.filter = `brightness(0.5) sepia(1) saturate(10000%) hue-rotate(${logo.dColorWheel}rad)`;
} }
const makeSvg = (coords) => { const makeLine = (a, b, color='white') => `<line x1="${a.x}" x2="${b.x}" y1="${a.y}" y2="${b.y}" stroke="${color}" />`;
const makeLine = (a, b, color='white') => `<line x1="${a.x}" x2="${b.x}" y1="${a.y}" y2="${b.y}" stroke="${color}" />`; const makeSvg = (coords) => `
return `
<svg xmlns='http://www.w3.org/2000/svg' width='${window.innerWidth}px' height='${window.innerHeight}px'> <svg xmlns='http://www.w3.org/2000/svg' width='${window.innerWidth}px' height='${window.innerHeight}px'>
<rect x="0" y="0" width="${window.innerWidth}" height="${window.innerHeight}" fill="${document.body.style.backgroundColor || "black"}"/>
${coords.map((_,i) => { ${coords.map((_,i) => {
if (i == 0) { if (i == 0) {
return; return;
@ -74,7 +71,6 @@ const makeSvg = (coords) => {
}).join('')} }).join('')}
</svg> </svg>
`; `;
}
const setBackgroundToSvg = (svg) => { const setBackgroundToSvg = (svg) => {
document.getElementById("container").style.background = 'url(data:image/svg+xml;base64,'+btoa(svg)+')'; document.getElementById("container").style.background = 'url(data:image/svg+xml;base64,'+btoa(svg)+')';