three-dom-elements
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

three-dom-elements npm Minzipped npm License

A lightweight three.js extension to integrate DOM elements into your scene.

Usage

The following projects an iFrame into a threejs scene as a plane. You can use this plane as normal with techniques like raycasting, etc.

View the live demo.

Demo preview

import { DOMContext, DOMElement } from 'three-dom-elements';

// Create a DOM context to draw with
const context = new DOMContext(camera);
context.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(context.domElement);

// Create an element to project
const element = document.createElement('iframe');
element.src = 'https://threejs.org';
element.style.border = 'none';

// Project it
const element = new DOMElement(context, element);
scene.add(element);

Readme

Keywords

none

Package Sidebar

Install

npm i three-dom-elements

Weekly Downloads

9

Version

1.2.1

License

MIT

Unpacked Size

13 kB

Total Files

8

Last publish

Collaborators

  • codyjasonbennett