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

react-3d-shapes

v1.0.3

Published

`react-3d-shapes` is a React library for creating 3D shapes using the Three.js library. It provides a simple way to integrate 3D scenes into your React applications with pre-built components.

Downloads

288

Readme

react-3d-shapes

react-3d-shapes is a React library for creating 3D shapes using the Three.js library. It provides a simple way to integrate 3D scenes into your React applications with pre-built components.

Table of Contents

Installation

You can install the library using npm or yarn:

npm install react-3d-shapes

or

yarn add react-3d-shapes

Usage

Shapes Component

The Shapes component allows you to render various 3D scenes. It uses Three.js to create 3D shapes and integrates with React using hooks.

Example

Here's a basic example of how to use the Shapes component in your React application:

import React from 'react';
import { Shapes } from 'react-3d-shapes';

const App = () => {
  return (
    <div style={{ width: '800px', height: '600px' }}>
      <Shapes
        scene="squares"
        width={800}
        height={600}
        backgroundColor="#ffffff">
        {/* Add additional children or components here if needed */}
      </Shapes>
    </div>
  );
};

export default App;

Creating and Configuring Scenes

The Shapes component supports various 3D scenes through the scene prop. The current supported scene type is "squares", which creates a 3D scene with cubes.

Props

  • scene: The type of scene to create. Currently supports "squares".
  • rendererProps: Additional props to pass to the renderer’s container <div>. This allows you to customize the container's HTML attributes.
  • width: Width of the 3D canvas.
  • height: Height of the 3D canvas.
  • backgroundColor: Background color of the 3D canvas.

Example with Additional Props

import React from 'react';
import { Shapes } from 'react-3d-shapes';

const App = () => {
  return (
    <div style={{ width: '100%', height: '500px' }}>
      <Shapes
        scene="squares"
        width={1200}
        height={500}
        backgroundColor="#000000"
        rendererProps={{
          style: { border: '1px solid #ccc' },
        }}
        cubeSize={50} // Custom prop example (if supported)
      >
        {/* Additional content can be placed here */}
      </Shapes>
    </div>
  );
};

export default App;

Props

The Shapes component accepts the following props:

  • scene (SceneTypes): The type of scene to display. Currently, only "squares" is supported.
  • rendererProps (HTMLAttributes<HTMLDivElement>): Additional attributes for the renderer’s container <div>.
  • width (number): Width of the canvas.
  • height (number): Height of the canvas.
  • backgroundColor (string): Background color of the canvas.
  • cubeSize (number, optional): Size of the cubes in the "squares" scene.

Contributing

Contributions are welcome! Please follow these guidelines to contribute to the project:

  1. Fork the repository: Create a copy of the repository on your own GitHub account.
  2. Clone the repository: Clone your fork to your local machine.
  3. Create a new branch: Make your changes in a new branch.
  4. Commit your changes: Write clear and concise commit messages.
  5. Push your changes: Push your branch to your forked repository.
  6. Submit a pull request: Open a pull request from your branch to the main repository.

Please ensure your code adheres to the existing style and includes appropriate tests where applicable.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

This library is maintained by spaceholderdjs.