Anybody used web-animations polyfill?

Game development with Board Game Arena Studio
Post Reply
User avatar
shadowphiar
Posts: 124
Joined: 01 January 2017, 16:07

Anybody used web-animations polyfill?

Post by shadowphiar »

In a new project, I'm doing some experiments using element.animate() from the Web Animations api (a javascript equivalent to CSS animations). This is working very well on up-to-date browsers, but I'd also like to load the web-animations-js polyfill so that the same code works on older browsers (e.g. I have an iPad here with Safari iOS 10.3 on it). web-animations.min.js is under 50k and falls back to using native calls when the browser supports them.

Has anybody used this, or a similar "external" js files in a BGA project? I've put the file into my "modules" directory, but I'm not sure how to reference it to get it to load at the right time. The documentation assumes you have control of the whole page's html, and just suggests putting this somewhere near the top:

Code: Select all

<!-- Include the polyfill -->
<script src="web-animations.min.js"></script>
but obviously this isn't possible to game developers, at least not directly. Any tips?
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Anybody used web-animations polyfill?

Post by Tisaac »

I am using some external libs in my projects. You can either load them in your tpl file by using the GAMEURL variable to have the correct URL, or you load them using dojo if you need them in your js (eg I'm loading Hammerjs for Santorini in my js directly).
User avatar
shadowphiar
Posts: 124
Joined: 01 January 2017, 16:07

Re: Anybody used web-animations polyfill?

Post by shadowphiar »

Thanks, yes using the .tpl works (though I had to use "{GAMETHEMEURL}" for the substitution).
Post Reply

Return to “Developers”