diff --git a/00-example-empty/index.html b/00-example-empty/index.html index e293be9..84bd945 100644 --- a/00-example-empty/index.html +++ b/00-example-empty/index.html @@ -14,6 +14,7 @@ +
diff --git a/aLib/osscilators.js b/aLib/osscilators.js index 589b05b..4d51dae 100644 --- a/aLib/osscilators.js +++ b/aLib/osscilators.js @@ -1,9 +1,9 @@ function oscillate_linear(x1, y1, x2, y2, speed) { - //MATH referance: https://skysmart.ru/articles/mathematic/grafik-linejnoj-funkcii - let a = (y1 - y2) / (x1 - x2) - let b = y1 - a * x1 - let iter = sin(frameCount / speed) - let newX = map(iter, -1, 1, x1, x2) - let newY = a * newX + b - ellipse(newX, newY, random(1,5)) - } \ No newline at end of file + //MATH referance: https://skysmart.ru/articles/mathematic/grafik-linejnoj-funkcii + let a = (y1 - y2) / (x1 - x2) + let b = y1 - a * x1 + let iter = sin(frameCount / speed) + let newX = map(iter, -1, 1, x1, x2) + let newY = a * newX + b + ellipse(newX, newY, random(1, 5)) +} \ No newline at end of file diff --git a/aLib/pagination.js b/aLib/pagination.js new file mode 100644 index 0000000..2fdaf74 --- /dev/null +++ b/aLib/pagination.js @@ -0,0 +1,119 @@ +const direction = document.location.host === "hanumanum.github.io" ? "/p5experiments/" : ""; + +const pages = [ + { + url: "art-cardioid", + }, + { + url: "art-noize-rotating-fans", + } + , + { + url: "art-constalation", + } + , + { + url: "art-flower-of-life", + }, + { + url: "art-arcs", + }, + { + url: "art-arrows", + }, + { + url: "art-artificial-alphabets" + }, + { + url: "art-graph" + }, + { + url: "art-infection" + }, + { + url: "art-letter-flower" + } + , + { + url: "art-letter-flowers" + } + , + { + url: "art-oscilating-squares" + } + , + { + url: "art-particles" + } + , + { + url: "art-light-propagation" + } + , + { + url: "art-psy-rect-blanding-modes" + } + , + { + url: "art-text-circle-packing-edges" + } + , + { + url: "art-text-entropy" + } + , + { + url: "art-text-flow-fields" + } + /* + { + url: "art-floating-points" + }*/ + +] + + +const findCurrentIndex = () => { + + const slug = document.location.pathname.split("/").filter((e) => e !== "").pop(); + for (let i = 0; i < pages.length; i++) { + if (pages[i].url === slug) { + return i; + } + } + return -1; +} + + +window.onload = () => { + const currentIndex = findCurrentIndex(); + if (currentIndex === -1) return + if (currentIndex > 0) { + const prev = document.createElement("div"); + prev.id = "go-prev"; + prev.innerHTML = "prev"; + prev.onclick = () => { + document.location.assign(direction + "/" + pages[currentIndex - 1].url); + } + + document.body.appendChild(prev); + } + + + if (currentIndex < pages.length - 1) { + + const next = document.createElement("div"); + + next.id = "go-next"; + next.innerHTML = "next"; + next.onclick = () => { + console.log(pages[currentIndex + 1]); + document.location.assign(direction + "/" + pages[currentIndex + 1].url); + } + + document.body.appendChild(next); + } + +} + + diff --git a/art-arcs/index.html b/art-arcs/index.html index bcbe386..49ddfe7 100644 --- a/art-arcs/index.html +++ b/art-arcs/index.html @@ -3,12 +3,15 @@ + + +