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

voxelamming-node

v1.0.0

Published

This JavaScript package converts JavaScript code into JSON format and sends it to the Voxelamming app using WebSockets, allowing users to create 3D voxel models by writing JavaScript scripts.

Downloads

2

Readme

voxelamming-node

This JavaScript package converts JavaScript code into JSON format and sends it to the Voxelamming app using WebSockets, allowing users to create 3D voxel models by writing JavaScript scripts.

What's Voxelamming?

Voxelamming is an AR programming learning app. Even programming beginners can learn programming visually and enjoyably. Voxelamming supports iPhones and iPads with iOS 16 or later, and Apple Vision Pro.

Resources

  • Homepage: https://creativival.github.io/voxelamming/index.en
  • Samples: https://github.com/creativival/voxelamming/tree/main/sample/python

Installation

npm install voxelamming-node

Usage

// const { BuildBox } = require('voxelamming-node');

(async () => {
  const roomName = '1000';
  const buildBox = new BuildBox(roomName);

  buildBox.setBoxSize(0.5);
  buildBox.setBuildInterval(0.01);

  for (let i = 0; i < 100; i++) {
    buildBox.createBox(-1, i, 0, 0, 1, 1);
    buildBox.createBox(0, i, 0, 1, 0, 0);
    buildBox.createBox(1, i, 0, 1, 1, 0);
    buildBox.createBox(2, i, 0, 0, 1, 1);
  }

  for (let i = 0; i < 50; i++) {
    buildBox.removeBox(0, i * 2, 0);
    buildBox.removeBox(1, i * 2 + 1, 0);
  }

  await buildBox.sendData("main");
  console.log('send data done')
})().catch(error => {
  console.error(error);
});

This code snippet demonstrates a simple example where a red voxel is created at a specific location. You can use various functions provided by the BuildBox class to build more complex models.

Method description

| Method name | Description | Arguments | |---|---|---| | setRoomName(roomName) | Sets the room name for communicating with the device. | roomName: Room name (string) | | setBoxSize(size) | Sets the size of the voxel (default: 1.0). | size: Size (float) | | setBuildInterval(interval) | Sets the placement interval of the voxels (default: 0.01 seconds). | interval: Interval (float) | | changeShape(shape) | Changes the shape of the voxel. | shape: Shape ("box", "square", "plane") | | changeMaterial(isMetallic, roughness) | Changes the material of the voxel. | isMetallic: Whether to make it metallic (boolean), roughness: Roughness (float) | | createBox(x, y, z, r, g, b, alpha) | Places a voxel. | x, y, z: Position (float), r, g, b, alpha: Color (float, 0-1) | | createBox(x, y, z, texture) | Places a voxel with texture. | x, y, z: Position (float), texture: Texture name (string) | | removeBox(x, y, z) | Removes a voxel. | x, y, z: Position (float) | | writeSentence(sentence, x, y, z, r, g, b, alpha) | Draws a string with voxels. | sentence: String (string), x, y, z: Position (float), r, g, b, alpha: Color (float, 0-1) | | setLight(x, y, z, r, g, b, alpha, intensity, interval, lightType) | Places a light. | x, y, z: Position (float), r, g, b, alpha: Color (float, 0-1), intensity: Intensity (float), interval: Blinking interval (float), lightType: Type of light ("point", "spot", "directional") | | setCommand(command) | Executes a command. | command: Command ("axis", "japaneseCastle", "float", "liteRender") | | drawLine(x1, y1, z1, x2, y2, z2, r, g, b, alpha) | Draws a line between two points. | x1, y1, z1: Starting point (float), x2, y2, z2: Ending point (float), r, g, b, alpha: Color (float, 0-1) | | sendData(name) | Sends voxel data to the device; if the name argument is set, the voxel data can be stored and reproduced as history. | | | clearData() | Initializes voxel data. | | | translate(x, y, z, pitch, yaw, roll) | Moves and rotates the coordinate system of the voxel. | x, y, z: Translation amount (float), pitch, yaw, roll: Rotation amount (float) | | animate(x, y, z, pitch, yaw, roll, scale, interval) | Animates a voxel. | x, y, z: Translation amount (float), pitch, yaw, roll: Rotation amount (float), scale: Scale (float), interval: Interval (float) | | animateGlobal(x, y, z, pitch, yaw, roll, scale, interval) | Animates all voxels. | x, y, z: Translation amount (float), pitch, yaw, roll: Rotation amount (float), scale: Scale (float), interval: Interval (float) | | pushMatrix() | Saves the current coordinate system to the stack. | | | popMatrix() | Restores the coordinate system from the stack. | | | frameIn() | Starts recording a frame. | | | frameOut() | Ends recording a frame. | | | setFrameFps(fps) | Sets the frame rate (default: 2). | fps: Frame rate (int) | | setFrameRepeats(repeats) | Sets the number of frame repetitions (default: 10). | repeats: Number of repetitions (int) |

Notes

  • Ensure that the Voxelamming app is running and connected to the same room name specified in your JavaScript script.

This library is under active development. More features and improvements are planned for future releases.

License

MIT License

Author

creativival