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

3d-elements

v1.0.7

Published

A library for rendering geometric solids comprised of html and svg elements 3d rotated using the transform CSS property, providing interfaces for controlling the rotation and position of rendered shapes.

Downloads

28

Readme

3d-Elements

Description

A library for rendering geometric solids comprised of html and svg elements 3d rotated using the transform CSS property, providing interfaces for controlling the rotation and position of rendered shapes.

Installation

load as script tag

<script src='https://unpkg.com/3d-elements'></script>

NPM

npm install --save 3d-elements

Examples

rendering shapes in HTML

In the following HTML fragment, the library is loaded from the script tag, so:

  • the library will:
    1. the e3d base stylesheet to the document,
    2. attach an event listener to the document to run the buildShapesInDom function after the onLoad event. The buildShapesInDom function selects all elements with the "e3d-shape" attribute (except those created in javascript) and calls the fromDom method of the Shape corresponding to the attribute value.
  • Decagon.fromDom will be called with the figure element as its argument which so:
    1. any existing children of the e3d-shape element will become e3d-faces, with their children still in place.
    2. Extra e3d-face children will be added to ensure the e3d-shape element has the right number of faces.
    3. the figure element will be styled based on its size, spin and face-class attribute
    4. the 'gradual' and 'constant' properties will be added to the element - these are interfaces for moving and rotating the shape during runtime.
<script src='https://unpkg.com/3d-elements'></script>
<figure e3d-shape="Decagon" 
size="50 100 50" 
spin="30 60 10" 
face-class="preset-e3d-green preset-e3d-centered">
    <div>first face</div>
    <div>
        <p>second face</p>
        <p>it has <b>more</b> content</p>
    </div>
</figure>

creating shapes in javascript

The 'make' object exposes the functions for creating new shapes. Each function returns the e3d-shape element (with the e3d-face element children) which can be appended to the document.

var dodecahedron = e3d.make.Dodecahedron({
    faceClass:'preset-e3d-black',
    size: [200],
    spin: [0,0,0],
    move: [0,100,0],
    faceContent: '<p>This mark-up will be added to each face</p>'
})
document.querySelector('div').appendChild(dodecahedron)

supported shapes

  • Cube
  • Pyramid
  • Dodecahedron
  • Cuboid
  • Decagon
  • Hexagon
  • Icosahedron
  • Octahedron
  • PentagonalTrapezohedron
  • Tetrahedron
  • TruncatedCube