Files
lettersail/assets/site/prices.js
T

36 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{
const rnd=seed=>()=>{seed=(seed*1664525+1013904223)>>>0;return seed/4294967296};
const HAND={
" ":[24,""],
"Ц":[52,"M8 4C6 40 7 70 9 90L44 89C43 60 43 30 45 4M44 89C46 94 48 99 49 106"],
"Е":[46,"M42 7L12 6C10 36 10 66 12 96L45 94M11 50L35 48"],
"Н":[50,"M8 4C6 40 7 70 9 98M44 4C43 40 43 70 45 98M8 50L44 47"],
"Ы":[56,"M8 6C6 40 7 70 9 96C30 98 36 84 34 72C32 58 22 52 9 54M48 6C47 40 47 70 49 98"],
"0":[46,"M23 4C38 3 43 28 42 52C41 78 35 98 23 98C11 98 5 78 5 52C5 26 10 5 25 4"],
"1":[30,"M6 22C12 16 18 10 22 4C21 36 21 68 23 98"],
"2":[44,"M6 22C8 8 18 3 26 4C38 6 42 20 36 34C30 50 14 70 4 96L42 95"],
"3":[44,"M6 14C12 5 22 2 30 6C42 12 40 34 22 46C40 46 46 62 42 78C38 94 18 100 4 88"],
"4":[46,"M34 98C33 70 33 36 35 4L4 66L44 64"],
"5":[44,"M40 6L12 6L8 44C16 38 26 38 34 44C46 54 44 84 30 94C20 100 10 96 4 88"],
"6":[44,"M36 8C20 2 8 24 6 52C5 82 14 98 26 97C38 96 42 82 40 68C38 52 26 48 16 52C10 55 7 60 6 64"],
"7":[44,"M4 7L42 5C32 34 22 64 16 98"],
"8":[44,"M22 46C8 40 6 14 22 5C36 -2 44 18 34 32C28 40 22 44 22 46C38 52 44 66 40 82C36 98 12 100 6 84C2 70 10 54 22 46"],
"9":[44,"M38 40C36 52 24 56 14 50C4 42 6 14 20 6C34 0 42 14 40 34C38 58 34 82 22 98"]
};
const handWord=(text,seed)=>{
const r=rnd(seed);
let cx=0,h="";
[...text].forEach(ch=>{
const g=HAND[ch];
if(!g)return;
if(g[1])h+=`<path class="hl-ink" d="${g[1]}" transform="translate(${cx.toFixed(1)} 0) scale(1 1.36)"/>`;
cx+=g[0]+(/\d/.test(ch)?10:16);
});
return `<svg viewBox="-14 -20 ${(cx+12).toFixed(0)} 180" aria-hidden="true">${h}</svg>`;
};
document.querySelectorAll("[data-hand]").forEach(el=>{
const t=el.dataset.hand,txt=/^\d+$/.test(t)&&t.length>3?t.slice(0,t.length-3)+" "+t.slice(-3):t;
el.innerHTML=handWord(txt,+el.dataset.seed||3);
});
})();