diff --git a/js/svg/rainPass.js b/js/svg/rainPass.js index 51387da..ff5f661 100644 --- a/js/svg/rainPass.js +++ b/js/svg/rainPass.js @@ -62,7 +62,7 @@ export default ({ artboard, config }) => { columnPos[0] = pos[0]; const columnTimeOffset = randomFloat(columnPos) * 1000; columnPos[0] += 0.1; - const columnSpeedOffset = randomFloat(columnPos) * 0.5 + 0.5; + let columnSpeedOffset = randomFloat(columnPos) * 0.5 + 0.5; if (config.loops) { columnSpeedOffset = 0.5; } @@ -104,7 +104,7 @@ export default ({ artboard, config }) => { const xml = xmlParser.parseFromString(glyphSVG.text(), "image/svg+xml"); const defs = xml.querySelector("defs"); const symbols = [...defs.querySelectorAll("symbol")]; - const symbolsByID = new Map(symbols.map(symbol => (["#" + symbol.id, symbol]))); + const symbolsByID = new Map(symbols.map(symbol => (["#" + symbol.id, symbol.innerHTML]))); const symbolSize = symbols[0].getAttribute("width") || 64; const time = 1 * config.animationSpeed; // TODO: effect @@ -117,7 +117,8 @@ export default ({ artboard, config }) => { const pos4 = vec4.create(); for (const {pos, brightness, isCursor, symbol} of glyphs) { - if (brightness < 0.1) { + // TODO: use actual thresholds + if (brightness < 0.6) { continue; } @@ -179,14 +180,14 @@ export default ({ artboard, config }) => { const group = []; // group.push(``); - group.push(``); + group.push(`${symbolsByID.get(base)}`); const glintBrightness = brightness * 2 - 1; const glint = `#sym_${symbol}_glint`; if (glintBrightness > 0 && symbolsByID.has(glint)) { const glintChannel = Math.floor(0xFF * glintBrightness); const glintColor = "#" + (glintChannel << 16 | glintChannel << 8).toString(16).padStart(6, "0"); - group.push(``); + group.push(`${symbolsByID.get(glint)}`); } glyphElements.push([depth, `${group.join(" ")}`]); @@ -196,8 +197,7 @@ export default ({ artboard, config }) => { output.innerHTML = [ ``, - defs.outerHTML, - ``, + ``, glyphElements.map(([depth, tag]) => tag).join("\n") ].join("\n");