This is another lyric video written in JavaScript, that runs in the browser, that I've recorded and uploaded to YouTube.
Well this is just like my previous JS Lyric Video. This time, it's a visual adventure ✨, in that the original video contains a piece of code that relates to the lyrics, and I've taken it, adapted it from Java to JavaScript (specifically, TS), spent a bit writing the code for the glide animation, and it was done! It's really pretty, this one. I like it a lot.
I don't plan on publishing the code or the apps. The codes are extremely messy, and I really don't feel like tidying them up. So basically:
For the "printer" part, that of the lyrics (the 'typewriting' effect and the per-word 'fade' effect (see my first video)), the app uses a .json file which contains all the lyrics, along with timestamps, which is generated from a .srt file that I either downloaded or have written manually. Every 50 milliseconds, so 20 times a second, the app does the following:
For the "scroller" part (the code displayed in this video), I've manually separated the code into "groups" (based on the original video), and manually added start and end timestamps for each group. The app then, every 25 ms, so 40 times per second, for each group:
<pre>
tag.
<pre>
tag, which it has no way of knowing before writing it to the DOM. So what the app does is generate the <pre>
tag, with no position, and opacity set to 0, place it in the DOM and use this element's height to do the calculation, then update it, removing the opacity setting, and applying the position absolute. It's really beautiful and I'm surprised that this thing running at 40 TPS doesn't affect the performance of my browser at all (when not recording anyway).Yes, yes, do check out my channel. I upload random stuff (mostly lyric videos and memes about friends) whenever I feel like.