Skip to content

Commit

Permalink
Settings from URL
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Jul 15, 2022
1 parent 51d0667 commit a5ae33b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ let ctx = c.getContext("2d");
let hue;
let drops;

function updateFromURL() {
const urlParams = new URLSearchParams(window.location.search);
let urlSettings = JSON.parse(urlParams.get("s"));
if (urlSettings) {
settings = { ...settings, ...urlSettings };
console.log(settings);
}
}

function init() {
hue = 0;

Expand Down Expand Up @@ -121,5 +130,6 @@ function hexToRgb(hex) {
} : null;
}

updateFromURL();
init();
draw();

0 comments on commit a5ae33b

Please sign in to comment.