I am trying to find a way if possible to calculate the duration of a CSS Keyframe animation based on viewport. Tried to do something like this:
calc((100vw / 75) * 1s);
but I think I won't be able to get a Result without use of JS, which works fine so far like this:
var animTime = jQuery(window).width() / 75;
jQuery('.animation-container').css('animationDuration', animTime + 's');
jQuery('.animation-container').addClass('anim');
It's mostly a question if any css wizard out there knows of a pure CSS approach for something like this.
A CSS-only solution and chrome-only. Not ready for production use but a good use case for what you want:
More detail: https://dev.to/janeori/css-type-casting-to-numeric-tanatan2-scalars-582j