Created
November 9, 2023 09:18
-
-
Save dk5ax/f7370326a3f615b2694b8fed6e7ce2ae to your computer and use it in GitHub Desktop.
Code 100 2023-11-09
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on: https://gist.github.com/codepo8/31b9ad820c03916941c294c404831829 | |
const input = { | |
"cols": 30, | |
"sine": [ | |
"-0.93", "-0.60", "-0.33", "-0.13", "0.00", | |
"0.00", "-0.13", "-0.33", "-0.60", "-0.93" | |
], | |
"parts": ["💻", "💖"] | |
}; | |
const center = input.cols / 2; | |
const func = [ | |
(el) => Math.floor(center/2 - Math.round(center/2 * (+el))), | |
(el) => center + Math.ceil(center/2 + Math.round(center/2 * (+el))) | |
] | |
for (let i = 0; i < 2; i++) { | |
input.sine.forEach(el => { | |
const linearr = Array(input.cols).fill(" "); | |
[0,1].forEach(j => linearr[func[j](el)] = input.parts[j]); | |
console.log(linearr.join('')); | |
}); | |
input.parts.reverse(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment