0.1.7 • Published 2 years ago

hexagon-3d v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Build Status

hexagon-3d

A small service for providing styles object for CSS-based 3d hexagons with high interactivity capabilities. You may use these shapes as skeletons for various animations, images adding, videos playing, combining them into different forms, and doing a lot of other things. The capabilities of hexagons will be growing over time.

If you are building your project with React you can use React component wrapper for the hexagon service which provides a graphical HTML part out of the box: hexagon-3d-react

Live demo:

Hexagon3D

Explanation tutorial

You can read more about hexagon geometry, construction features, and package details in my Medium article.

alt Samples

Installation

npm install hexagon-3d

Usage

import hexagon3D from 'hexagon-3d';

or

const hexagon3D = require('hexagon-3d').default;

After importing hexagon service is ready to be used:

const hexagonData = hexagon3D({<parameters>});

Returned parameters than can be used to build an HTML structure for hexagon sides.

Example of usage

`<div style={hexagonData.container.style}>
    <div id={hexagonData.container.top.id} style={hexagonData.container.top.style}>
        {topChildren}
    </div>

    <div id={hexagonData.container.side1.id} style={hexagonData.container.side1.style}>
        {side1Children}
    </div>

    <div id={hexagonData.container.side2.id} style={hexagonData.container.side2.style}>
        {side2Children}
    </div>

    <div id={hexagonData.container.side3.id} style={hexagonData.container.side3.style}>
        {side3Children}
    </div>

    <div id={hexagonData.container.side4.id} style={hexagonData.container.side4.style}>
        {side4Children}
    </div>

    <div id={hexagonData.container.side5.id} style={hexagonData.container.side5.style}>
        {side5Children}
    </div>

    <div id={hexagonData.container.side6.id} style={hexagonData.container.side6.style}>
        {side6Children}
    </div>

    <div id={hexagonData.container.bottom.id} style={hexagonData.container.bottom.style}>
        {bottomChildren}
    </div>
`</div>

Parameters

NameTypeDescriptionValues
widthnumberWidth of the hexagon (the biggest distance of it's 2 opposite points)any
heightnumberHeight of the hexagon sidesany
rotateZnumberRotation degrees round Z axis0-360
rotateXnumberRotation degrees round X axis0-360
showShadowbooleanFlag to indicate whether faces border shadow should be shown (default - false)true, false
shadowColorstringColor of a faces border shadowany
growTopbooleanFlag which indicates how hexagone should change it's height - to the top or to the bottom. (default - false)true, false
topBottomColorstringColor of hexagon top and bottom sidesany
sidesColorstringColor of hexagon sidesany
opacitynumberOpacity of hexagon sides0.0 - 1.0
showTransitionbooleanIndicate whether height change animation should be shown (default - false)true, false

Next iterations

  • Add tooltips for each side
  • Add more styling capabilities
  • Add rotations and other animation effects
  • Add deeper sides interactions
  • Optimize CSS properties
0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago