sussy commit now theres commin soon on itchio sus sussybaka

This commit is contained in:
2023-03-21 12:03:05 +01:00
parent 136785e5be
commit c7a70fc5fc
3 changed files with 69 additions and 2 deletions

33
script.js Normal file
View File

@@ -0,0 +1,33 @@
document.addEventListener('DOMContentLoaded', () => {
console.log('DOM fully loaded and parsed');
var rotated_text = document.getElementById('rotated_text');
var old_width = rotated_text.offsetWidth;
var width;
// animation frame loop
function loop() {
// get widt of div with id="rotated_text"
width = rotated_text.offsetWidth;
// if width has changed
if (width != old_width) {
// set new width
old_width = width;
// set font-size of p inside rotated_text to width * n
rotated_text.children[0].style.fontSize = width * 0.15 + 'px';
}
requestAnimationFrame(loop);
}
// start the loop
requestAnimationFrame(loop);
});