npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

three-css3d

v1.0.6

Published

A typescript port of Three.js CSS3DRenderer, with small tweaks and enchancements.

Downloads

825

Readme

three-css3d

A typescript port of Three.js CSS3DRenderer, with small tweaks and enhancements.

Originally from:
http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs

Based On:
mrdoob/three.js & ivee-tech/three-css3drenderer

Installation

npm i -S three three-css3d

Usage

import {Scene, PerspectiveCamera} from 'three';
import {CSS3DRenderer, CSS3DSprite, CSS3DObject} from 'three-css3d';

// Create Scene, camera and renderer
const scene = new Scene();
const camera = new PerspectiveCamera(50, 1, 0, 500);
const renderer = new CSS3DRenderer();

document.body.appendChild(renderer.domElement);

// Create DOM for CSS3D
const objectDOM = document.createElement('div');
const spriteDOM = document.createElement('div');

// Update style, content for your DOM
// ...

// Create CSS3D Objects
const object = new CSS3DObject(objectDOM);
const sprite = new CSS3DSprite(spriteDOM);

// Change the 3D property of CSS3D Objects
// ...

// Add to your scene
scene.add(object, sprite);

// Render, on each frame, or manually
renderer.render(scene, camera);

API

CSS3DRenderer

class CSS3DRenderer()

CSS3DRenderer.domElement
Container element of CSS3D Scene.

CSS3DRenderer.cameraElement
Camera element of CSS3D transform.

CSS3DRenderer.getSize()
Get the size of container element.

CSS3DRenderer.setSize(width: number, height: number)
Set the size of container element.

CSS3DRenderer.render(scene: three.Scene, camera: three.Camera)
Update CSS3D scene.

CSS3DObject

class CSS3DObject(element: HTMLElement) extends three.Object3D

element: Target DOM Element.

CSS3DObject.copy(source: CSS3DObject, recursive: boolean)
Copy content from another CSS3DObject.

see: three.Object3D for more detail.

CSS3DSprite

class CSS3DSprite(element: HTMLElement, spriteRatio:number = 1) extends CSS3DObject

element: Target Sprite DOM Element.
spriteRatio: The ratio for sprite rotation compensation, 1 for full sprite, 0 for normal 3D object.

CSS3DSprite.spriteRatio
Value of current spriteRatio