0.1.6 • Published 2 years ago

hexagon-3d-react v0.1.6

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

Build Status

hexagon-3d-react

A React based component wrapper for the hexagon-3d service. Hexagon-3d 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.

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-react

Usage

import Hexagon3D from 'hexagon-3d';

or

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

After importing hexagon service is ready to be used as a regular React component:

render (<Hexagon3D <parameters>>);

Example of usage

`<Hexagon3D
    width={130}
    height={150}
    rotateZ={20}
    rotateX={40}
    growTop={true}
    topChildren={<h1><span>Top</span></h1>}
    side1Children={<h1><span>Side</span><span>1</span></h1>}
    side2Children={<h1><span>Side</span><span>2</span></h1>}
    side3Children={<h1><span>Side</span><span>3</span></h1>}
    side4Children={<h1><span>Side</span><span>4</span></h1>}
    side5Children={<h1><span>Side</span><span>5</span></h1>}
    side6Children={<h1><span>Side</span><span>6</span></h1>}
/>`

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
topChildrenHTML, stringHTML element or string which will be placed on the top side of the hexagonany
side1ChildrenHTML, stringHTML element or string which will be placed on the side 1* of the hexagonany
side2ChildrenHTML, stringHTML element or string which will be placed on the side 2* of the hexagonany
side3ChildrenHTML, stringHTML element or string which will be placed on the side 3* of the hexagonany
side4ChildrenHTML, stringHTML element or string which will be placed on the side 4* of the hexagonany
side5ChildrenHTML, stringHTML element or string which will be placed on the side 5* of the hexagonany
side6ChildrenHTML, stringHTML element or string which will be placed on the side 6* of the hexagonany
bottomChildrenHTML, stringHTML element or string which will be placed on the bottom side of the hexagonany

*Hexagon sides direction:

alt Samples

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.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