Catalog npm
PACKAGE EXPLORERView in registry

3ui-aleguy02

npm

You can easily implement interactive 3D elements into your website's UI with this package

3ddesignhtmlinterfacejavascriptthreethree.jsuiuserweb
Versions collected2
Direct dependencies2From release 1.0.1
Last observed20 Oct, 19:53 UTC

README

Current package documentation

3UI lets you create interactive 3D elements to make your website a little more fun. It's currently made for beginner developers building websites with HTML, CSS, and Javascript. 3UI's elements dynamically react to different sized divs, or containers as I'll call them here. 3UI uses three.js to render scenes, I encourage you to take a look at three.js's official documentation if you want to understand what's going on under the hood. https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene

How To Use:

Creating these interactive elements can be done in 3 steps:

  1. Create a shape with one of the shape functions. Currently, 3UI supports three shapes: Cube, Sphere, and Diamond
  2. Create a scene with the Scene function
  3. Render the scene with the createScene function

Full Documentation

This is my first time attempting any sort of docs, please bear with me. I'll also be copy pasting some lines directly from three.js's official documentation, so again I encourage you to take a look if you want to understand what's happening.

Cube(color: hexadecimal number, wireframe: boolean)

Returns a Mesh object that looks like a cube.

color - Hexadecimal number representing the color of the shape. Default is 0xff0000 (red)

wireframe - Render geometry as wireframe. Default is false (i.e. render as flat polygons).

Sphere(color: hexadecimal number, wireframe: boolean)

Returns a Mesh object that looks like a sphere.

color - Hexadecimal number representing the color of the shape. Default is 0xff0000 (red)

wireframe - Render geometry as wireframe. Default is false (i.e. render as flat polygons).

Diamond(color: hexadecimal number, wireframe: boolean)

Returns a Mesh object that looks like a diamond.

color - Hexadecimal number representing the color of the shape. Default is 0xff0000 (red)

wireframe - Render geometry as wireframe. Default is false (i.e. render as flat polygons).

Scene(color: hexadecimal number)

Returns a Scene object that makes up the background of the render.

color - Hexadecimal number representing the background color of the scene. Default is 0xffffff (white)

createScene(shape: object, scene: object, id: string)

Renders a shape and scene and fits them into a container.

shape - Mesh object representing your shape

scene - Scene object representing your background color id - string representing the id property of the container interface representing the container's identifier, reflecting the id global attribute

Example Code

The following code creates a red cube on a white background contained in a div with the id "animation-container"

import * as ThreeUI from "3ui-aleguy02"

const shape = ThreeUI.Cube()
const scene = ThreeUI.Scene()
ThreeUI.createScene(shape, scene, "animation-container")

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 2

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.1Registry latest25 Apr 20242
1.0.025 Apr 20242

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:53 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:224ef97489b6e9b7427a8809493a9e2e7cbe8bff7cf70d5861518a565d8cab6f