/ Miscellaneous

Vue.js components rendering 3D graphics reactively via three.js

Vue.js components rendering 3D graphics reactively via three.js


Vue.js components for reactive 3D rendering. Depends on three.js.

You can render 3D components on canvas by coding custom html tags. It’s not only for integration with other Vue.js applications, but also for drawing 3D graphics more easier!


Define objects by tags.
Save the following code as a html file, and open in any modern browser.

<!-- dependencies -->
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/three"></script>

<!-- load components -->
<script src="https://unpkg.com/vue-gl"></script>

<!-- define objects -->
<vgl-renderer id="vgl-canvas" style="width: 300px; height: 150px;">
    <vgl-directional-light position="2 0 1"></vgl-directional-light>
  <vgl-perspective-camera orbit-position="200 1 1"></vgl-perspective-camera>

<!-- register components and start vue -->
  Object.keys(VueGL).forEach(name => {
    Vue.component(name, VueGL[name]);
  new Vue({
    el: "#vgl-canvas"

When you open the html above in the browser, you'll see below.
VueGL example

Note that IE9 needs a polyfill for the TypedArray class, like the js-polyfills/typedarray.js.