Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babylon-html-label

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babylon-html-label

`Babylon-html-label` is a library for Babylon.js that allows you to create HTML elements synchronized with 3D positions within the scene. This can be useful for labels, tooltips, or any HTML content that needs to follow a 3D object. [Live Demo](https://ba

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Babylon-html-label

Babylon-html-label is a library for Babylon.js that allows you to create HTML elements synchronized with 3D positions within the scene. This can be useful for labels, tooltips, or any HTML content that needs to follow a 3D object. Live Demo

Installation

To install this package, use npm:

npm install Babylon-html-label

Usage

Importing the Class

import { HTML2DLabel } from "Babylon-html-label";
import { Scene, Vector3 } from "@babylonjs/core";

Creating an HTML2DLabel

const labelElement = document.createElement("div");
labelElement.innerText = "Hello, World!";

const html2DLabel = new HTML2DLabel(
  "myLabel",
  {
    htmlElement: labelElement,
    center: true,
    onCameraMoveOnly: false,
    distanceFactor: 1.0,
  },
  scene
);

html2DLabel.position = new Vector3(0, 1, 0);
scene.addMesh(html2DLabel);

Parameters

  • name: string
    • The name of the label.
  • options: object
    • htmlElement: HTMLElement: The HTML element to attach.
    • center?: boolean: Center the HTML element (default: false).
    • onCameraMoveOnly?: boolean: Update position only when the camera moves (default: false).
    • el?: string: The HTML element tag to create (default: div).
    • distanceFactor?: number: Scale factor based on distance from the camera (default: 1).
  • scene: Scene
    • The Babylon.js scene.

Dispose

html2DLabel.dispose();

Disposes the HTML2DLabel and removes the HTML element from the DOM.

FAQs

Package last updated on 17 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc