add support for 360 panorama embeds yayyy

using naver view360
This commit is contained in:
maia arson crimew 2025-12-28 23:24:24 +01:00
parent ea7a060e0f
commit 9ffd3f1089
5 changed files with 44 additions and 0 deletions

View file

@ -12,6 +12,7 @@ const footnotes = require('eleventy-plugin-footnotes');
const figure = require('./src/_includes/components/figure.js');
const bounce = require('./src/_includes/components/bounce.js');
const view360 = require('./src/_includes/components/view360.js');
module.exports = function (eleventyConfig) {
const isDev = (process.env.ELEVENTY_ENV || "dev") == "dev";
@ -47,6 +48,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addShortcode('figure', figure(md));
eleventyConfig.addShortcode('bounce', bounce);
eleventyConfig.addShortcode('view360', view360);
eleventyConfig.addPassthroughCopy({ "src/static": "/" });
eleventyConfig.addPassthroughCopy({ "node_modules/reveal.js/dist/reveal.css": "reveal.js/reveal.css" });

View file

@ -0,0 +1,24 @@
// for now this only supports one type of projection because i cant be bothered to implement all of them lol
module.exports = async ({ src, ratio = '16by9', autoplay = false, autoplaySpeed = .2 }) => `
<link rel="stylesheet" href="/view360/view360.min.css">
<script src="/view360/view360.pkgd.min.js"></script>
<div id="viewer" class="view360-container is-${ratio}">
<canvas class="view360-canvas"></canvas>
</div>
<script>
const spinner = new View360.LoadingSpinner();
const controlBar = new View360.ControlBar();
const viewer = new View360("#viewer", {
plugins: [spinner, controlBar],
projection: new View360.EquirectProjection({
src: "${src}",
video: false
})${autoplay ? `,
autoplay: {
speed: ${autoplaySpeed}
}` : ''}
});
</script>
`

1
src/static/view360/view360.min.css vendored Normal file

File diff suppressed because one or more lines are too long

16
src/static/view360/view360.pkgd.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long