Catalog npm
Back to packageRELEASE DETAILS

1.0.7

npm

3d-elements

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.

Published2 Sept 2020
Direct dependencies5
Transitive dependenciesNot calculated

README

Current package documentation

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

Downloads & popularity

Awaiting observations

No metric observations yet

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

Declared dependencies 5

Native requirements
5 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
css-loader
Environment
{
  "local_name": "css-loader",
  "alias": false,
  "peer_metadata": null
}
^3.4.2development
style-loader
Environment
{
  "local_name": "style-loader",
  "alias": false,
  "peer_metadata": null
}
^1.1.3development
webpack
Environment
{
  "local_name": "webpack",
  "alias": false,
  "peer_metadata": null
}
^4.41.6development
webpack-cli
Environment
{
  "local_name": "webpack-cli",
  "alias": false,
  "peer_metadata": null
}
^3.3.11development
webpack-merge
Environment
{
  "local_name": "webpack-merge",
  "alias": false,
  "peer_metadata": null
}
^4.2.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-0S+pYj2TxWwvVzkEx1N5EYWXdZ1huSwS3mBxvfXZMvP5yHEhBMLw+MJfwFsr+R8ZvJLA04LIIs3doSvROVhfQA==",
  "shasum": "20e80c92bec7e502bb29880c5dfc06c735098f44",
  "tarball": "https://registry.npmjs.org/3d-elements/-/3d-elements-1.0.7.tgz",
  "fileCount": 32,
  "unpackedSize": 160706,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfT98HCRA9TVsSAnZWagAAfjcP/AobnuebXWJXVvwu+OFd\nTuB3MQx4fRbm+8DeazQaakf6ZmbJNuOw3kfQs9TsEYdsgsYYRjgTlLnEyt9s\nCbGttY41IdSZJnl0qk8ctdy8WIoHjUh1JXCg3+g42aLopkJy5nTwe6AImdTW\nyIKM/QVmRpTdMQnAFR1pY8ewALaRIMYpZlNKB2UUi4ukdIlaiLXZWe9X/Hi9\nBtLbv8jx0bxfg3kg2F4TQ0e3RKXvBgwbSEBCb0ajM1exRT7t/tbIadf67BQL\nXU2owe+agHNdDhHrF2P0r30UMWFGR7vfXbdUDMbiIlOiv68aZiyHDeGmxeCA\n+vx1erGbDbBAT1BbJ/iSGdZ2YxmwHGLDACW6NXLKv1tlVMYSE1WXLwionAQj\nqXZWItE/5vhXCjA0m2iib96ouHROk0zeJGC+TTYJ6BTNebZf4gQ/IdKzJFP0\nNjEB2338RARkIPq9W1w6GYbhKRxEmr+6o/DSVghLf0kNVxdcFhG6u/kljpX9\nlIJMjEzaUzKthn19wZ29tbp6IGz0ZcYSIIAieIYKgO5kXt0kfbFsg1ekRsX5\n4l2yafLNa4AjfXzaXTrtj6lq86Ld0dELKkA8WLz/JewvC/OV5fpHBrKcSSec\nXfdZaSyMgu4fcdRPogRl/7SlIRnPMUlmzSJUwFmeIO81hF4Wug5cl0Eo3gOj\nCjMh\r\n=s5+1\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIEmMOATkyUeN8jaYFUWfu//mZWlNo590d7oYOUG48I+OAiEAte/+bWnyXtclBy6mONbcKcJKXO8xT6e1XWw3J++35y4="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:34 UTC

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

Record identity

package_version:deef5096bcb23c19e92ea237b5da7d5a8d498bf99d4011b3ad278d6447ad9cbe

Other collected versions

1.0.62 Sept1.0.54 Apr1.0.419 Mar1.0.319 Mar1.0.23 Mar1.0.12 MarView all collected versions →