zestyxyz / ads-sdk

Monetize your spatial app with Zesty
https://zesty.xyz
Other
6 stars 3 forks source link

GIF/canvas support #211

Closed msub2 closed 5 months ago

msub2 commented 6 months ago

This PR adds support for using GIFs and HTML canvases as image sources for Zesty banners. This brings it to A-Frame and Wonderland Engine initially, but should be implementable for other integrations without too much difficulty.

For GIFs, it makes use of the gifler library to animate the GIF in a canvas, which can then be used as a texture source. For canvases, it creates a new iframe from an HTML document string (as canvases cannot be passed from third-party iframes) and uses the canvas in that document as a texture source.

limbofeather commented 5 months ago

Do you think it would be helpful to have tests for gif/canvas support for A-Frame?

msub2 commented 5 months ago

I did consider that but at the time I wasn't sure what the best way to go about it would have been. Thinking on it now though, it may be possible to use Playwright's screenshot feature and have it compare the page at two different times to see if it's animating properly.

msub2 commented 5 months ago

I'll take a look and see if that can be a quick lift before merging this, if it seems like it might be a bit more involved can maybe do in a follow up.

limbofeather commented 5 months ago

Not a blocker like I mentioned, adding it in a follow-up is good!

msub2 commented 5 months ago

Cool! I'll make an issue for it.