This commit is contained in:
Violet 2024-02-08 22:03:40 +00:00 committed by GitHub
parent 8c05dff3fd
commit 07edad0ea7
4 changed files with 151 additions and 2 deletions

View file

@ -4,6 +4,41 @@ fs = require('fs')
var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json')))
var highlightedWords = config.highlightedWords
function makeStars() {
var html = ""
for (let index = 0; index < 15; index++) {
html += `<div class="star"></div>`
}
html += "<style>"
for (let index = 0; index < 15; index++) {
html += `
.star:nth-of-type(${index + 1}) {
animation: starAnim${index} ${15 + (Math.random() * 15)}s linear;
animation-iteration-count: infinite;
animation-delay: ${-Math.random() * 15}s;
}
`
var rando = Math.random() * 100
html += `@keyframes starAnim${index} {
0% {
top: -10vh;
right: ${rando}vw;
visibility: visible;
}
100% {
top: 110vh;
right: calc(${rando}vw + ${5 - (Math.random() * 10)}vw);
}
}`
}
html += "</style>"
return html
}
function converter(html) {
var highTable = Object.keys(highlightedWords)
for (let index = 0; index < highTable.length; index++) {
@ -12,6 +47,8 @@ function converter(html) {
html = html.replaceAll(term, replacement)
}
html = html.replaceAll("{BG_EFFECT}", makeStars())
return html
}