Get started with diva.js CDN

MIT licensed

Diva.js: Versatile, efficient wrapper for interactive musical apps using Web Audio API.

Tags:
  • images
  • iiif
  • documents
  • libraries
  • archives

Stable version

Copied!

How to start using diva.js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with diva.js CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/diva.js/6.0.2/js/diva.min.js"></script>
    <style>
        #canvas { width: 100%; height: 100vh; border: 1px solid black; }
    </style>
</head>
<body>
    <div id="canvas"></div>
    <script>
        const diva = new DIVA.Scene({
            canvas: document.getElementById('canvas'),
            width: window.innerWidth,
            height: window.innerHeight,
            backgroundColor: 'white'
        });

        const box = new DIVA.Box({
            width: 1,
            height: 1,
            position: [0.5, 0.5, 0],
            color: 'red'
        });

        diva.add(box);
        diva.render();

        window.addEventListener('resize', () => {
            diva.resize();
            diva.render();
        });
    </script>
</body>
</html>

All versions